So why is this beautiful landscape picture bricking Android phones?
The answer lies in one pixel and basic math.
A pixel comprises of a color and a color comprises of three basic colors, Red, Green, Blue or RGB.
As you might remember from CSS, the typical range for R:G:B lies between 0 - 255, and android handles it well. But there's a huge range of color space which android doesn't understand and converts it RGB.
as you might see, the android sRGB space is narrow compared to other color spaces, but how is this relevant?
The above image was captured in Prophoto RGB color space, so when you open the image in the gallery, android tries to convert the image into sRGB color space, and here lies the problem.
There's one pixel in this image that causes this issue.
So when Android comes across a photo whose color space it doesnt support it modifies the image by the following formula :
and the overall result of this must be < 255.
Since 256 above the max limit, android throws an error. When we open the image in the gallery, it encounters the error and just might shut off the gallery.
It's fix ?
pixel_value = Math.min(255,res); //might be more complicated than this but this is my best guess
Crazy isn't it? How one pixel could crash our phones.
I hope you liked my article. Until next time :)
Source : https://twitter.com/UniverseIce/status/1266943909499826176