I am using the Image package and image picker to get the image and wanted to manipulate the image. I am trying to convert the default 32bit ARGB color format to an 8-bit color format. How can I do this in flutter?
Asked
Active
Viewed 230 times
0
-
What is "the 8-bit" color format? Do you mean indexed colors? – mkrieger1 Aug 18 '22 at 19:21
-
@mkrieger1 https://en.wikipedia.org/wiki/8-bit_color#:~:text=8%2Dbit%20color%20graphics%20are,is%20256%20or%2028. – Ayush Yadav Aug 18 '22 at 19:44
-
Okay, then... the article you have linked even explains how to convert 24-bit RGB to 8-bit, so what's the problem? – mkrieger1 Aug 18 '22 at 19:53
-
@mkrieger1 I figured out a expression to calculate the 8 bit color from rgb value ,but it is quite incorrect and not even close to the actual 8 bit color by 1 or 2 num. ```var color =((r * 6 / 256) * 36 + (g * 6 / 256) * 6 + (b * 6 / 256)).floor(); ``` – Ayush Yadav Aug 18 '22 at 20:01
-
Can you please update your question to include this code as a [mre]? – mkrieger1 Aug 18 '22 at 20:02