Insert Trumpets Here

Saturday, November 6, 2010

CDisplay(Ex) problems solved (?)

As you may or may not know, I use a program called pnqnqi to compress my PNG release files. It's an image quantizer that I found produces slightly smaller files than Photoshop's built-in Save For Web or other PNG optimization programs; the release archives are about 3-5% smaller. They all save grayscale images to indexed images, which are significantly smaller, because manga pages only have a small range of colors.

However, as I (and a few other scanlators) have painfully learned, CDisplay has a bizarre problem with indexed images that have transparency. Through some testing, I found out the problem was that any palette color with an alpha value of less than 255 is displayed as fully transparent. I have no idea why it does that.

People who use Save For Web can just make sure that the Transparency check-box isn't checked. For pngnqi, there's no option to disable transparency, so I used to just turn the alpha channel off with ImageMagick after I compressed it. Now I've "solved" the problem by changing line 599 in pngnq.c:

rwpng_info.trans[remap[x]] = map[x][3];


rwpng_info.trans[remap[x]] = 255;

This completely disables transparency. You'll need any flavor of gcc along with libpng and zlib to compile it. Strangely enough, I don't see a perceptible difference between the images, other than it works in CDisplay.

On a somewhat related note, does anyone have a better Hello World tutorial for OpenCL than ATI's? I was thinking of rewriting certain parts of pngnqi in OpenCL to try to make it faster and to start learning GPGPU programming, but it would hard if I can't even get the first example up and running in the first place.


  1. I'm interested in knowing how many people use CDisplay(Ex) as an image viewer. Is the number high enough that this problem has a significant effect?

  2. Never thought i'd read about opencl here.

    You could try this site:
    cmsoft tutorial

    nvidia also has some opencl stuff, but i don't know if it's that useful:
    nvidia site, links at bottom

    This may also be useful:
    opencl studio