[SDL] Ugly images under 16bit X11
Christophe Cavalaria
chris.cavalaria at free.fr
Sat Nov 11 03:54:29 PST 2006
sirk wrote:
> Hello. I have a question about image quality problems I'm seeing under X11
> when using a 16 bit color depth.
>
> Specifically, images that have a lot of gradients show very distinct color
> bands/stipes rather than smooth transitions from color to color.
> Similarly, images with lots of shading tend to display with strange
> artifacts.
>
> I assume it's because, one way or another, the pixels are getting mapped
> to
> their closest color value in the X11 color map. Since functions such as
> SDL_SetPalette are for 8 bit surfaces I'm at a loss for how to improve the
> display quality short of going with 24 or 32 which aren't options for me.
>
> Strangely, this even happens when the images themselves have been dropped
> to 8bit and contain only 200 colors. I only tried this when I couldn't
> get the original 24 bit images to work.
>
> I'm really at a loss, I've started messing around with X functions such
> XAllocColor but I decided I'd rather not break out of SDL until I've asked
> around a bit.
>
> Any ideas? Could it be some problem with X initialization or other
> obscure cause?
>
> thanks in advance.
As was said already, what you see is a lack of dithtering in the images
( dithtering was made to prevent such banding effects )
Now, the question is, are your original images you are blitting/displaying
16bit or 24bit? If the later, them you should reduce them to 16bit with a
program that knows about dithtering ( more or less any image manipulation
tool that can do 16bit images ) If the former, then there is no solution.
Reducing them to 8bit is a bad idea because the colors choosen for the image
are in 24bit and still won't map perfectly on the color space of a 16bit
mode.
More information about the SDL
mailing list