jiayouxjh / grafx2

Automatically exported from code.google.com/p/grafx2
0 stars 0 forks source link

24bit image conversion is flawed #441

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

The conversion of an image to 256 colors from a 24bit image on loading is quite 
poor. I think this has been discussed before but I don't remember where it 
stands. But since I stumbled across a good example of the differance between 
Grafx2 and Photoshop's algorithms I thought it was worth presenting.

It's clear that (whatever funky) algorithm is in play is ignoring 
primary-adjacent colors (that would be preserved by Median Cut f.ex.) and there 
are huge redundancies in some registers, such as the darks.

Original issue reported on code.google.com by annas...@hotmail.com on 23 May 2011 at 8:13

Attachments:

GoogleCodeExporter commented 9 years ago
The algorithm we use is the Median cut, but it's done in plain RGB colorspace 
instead of some perceptive one. And there are some hacks that were meant to 
make it work better, but in the end make it actually worse on some pictures.

Also, the current implementation of the Median cut needs a lot of memory 
(several megabytes) for various tables. Likely something can be done to improve 
that.

Original comment by pulkoma...@gmail.com on 23 May 2011 at 8:19

GoogleCodeExporter commented 9 years ago
I just spent half an hour uselessly trying to relive the old algorithm 
(comparing the french and english source code line by line), I give up for 
tonight. Anyway, if we have defective color perception, we should at least try 
to do it in 128 times less memory. And a practical goal would be the support of 
transparent RGB images : a specific RGB triplet designates the transparent 
color, we need to resolve a palette slot for it and reduce the others to 255. 
It exists in RGB and PNG, IIRC.

Original comment by yrizoud on 23 May 2011 at 10:34

GoogleCodeExporter commented 9 years ago
DawnBringer, can you provide the original truecolor image? I tried 
color-reducing the "Photoshop" part of your example, and strangely all the 256 
colors were preserved. Yeah I was about as tired as when I wrote the above 
comment (128->64, resolve->reserve, RGB and PNG -> *BMP* and PNG...)

Original comment by yrizoud on 14 Jun 2011 at 10:52

GoogleCodeExporter commented 9 years ago
Here...

Original comment by annas...@hotmail.com on 14 Jun 2011 at 11:41

Attachments:

GoogleCodeExporter commented 9 years ago
fixed in r1878.

Original comment by pulkoma...@gmail.com on 28 Nov 2011 at 10:31

GoogleCodeExporter commented 9 years ago

Original comment by pulkoma...@gmail.com on 8 Jan 2012 at 3:39