add bytesPerPixel and format getters
fix swapped red and blue components when saving RGBA