Ximagic Quantizer

All non-XnView related: softwares, formats, imaging, photography...

Moderators: XnTriq, helmut, xnview

User avatar
NM64
Posts: 79
Joined: Sun Aug 05, 2007 7:17 pm

Post by NM64 »

Oh, I also found a small grammatical error on your site that could confuse some people (like it did to me :P)

you have this:
...but don't change a RGB image to indexed color.
When it should be this:
...but doesn't change a RGB image to indexed color.
When it says "don't", it's giving the impression that the user should not do that :P

Oh, and I'm surprised at how multicore unfriendly Scolorq's code is (according to you that is) seeing that graphical-related things are usually very multicore friendly (like GPU-accelerated video encoding or the GPU acceleration in Photoshop for example)
brodriguez
Posts: 64
Joined: Sun Feb 01, 2009 2:15 am

Post by brodriguez »

Thanks for the grammatical correction, I've changed the text. :?

About the multicore processing, most algorithms work locally and it is easy to split the image and process each piece in a thread and synchronize only at the end (gaussian blur, convolutions etc).

In an iterative color reduction algorithm, if you split the image, there is only one palette which is iteratively refined and should be accessed from all the threads concurrently. This restriction makes the easy solution not applicable. AFAIK to make scolorq multicore it'll need several synchronization points in each iteration and/or synchronized access to the palette.
User avatar
NM64
Posts: 79
Joined: Sun Aug 05, 2007 7:17 pm

Re: Ximagic Quantizer

Post by NM64 »

I know this topic is kinda old now, and I made this a month ago, but I figured some people here might be interested in an example of something making use of color quantization (scolorq in my case).

http://www.wincustomize.com/skins.aspx? ... 3&libid=32

It's a Windows XP bootskin I made (I didn't make the original image). Since XP's bootscreen is limited to 16 colors, this was perfect for a one-time high-quality dithering algorithm.

Now you'll understand what I was trying to do with that image before. :P
eL_PuSHeR
Posts: 267
Joined: Sat Apr 25, 2009 9:23 am

Re: Ximagic Quantizer

Post by eL_PuSHeR »

Hello. First post here.

Any way to get true Black & White when dithering to 1bpp (2 colours)?. I guessed "uniform palette" was that, but I was wrong.

EDIT: OK, I have solved it. Too many parameters are misleading... :P
brodriguez
Posts: 64
Joined: Sun Feb 01, 2009 2:15 am

Re: Ximagic Quantizer

Post by brodriguez »

Hello

The Uniform quantization reduce colors by using less bits to represent each color component, it is not what your are looking for.

You can't get what you want in one step, but you can get it

1.- Convert to grayscale. In XNview use 256 graylevel without dithering.
2.- Convert back to RGB Color.
2.- Use Ximagic Quantizer to reduce to 2 colors. Usually you'll get the best results with SColorQ. If you use SColorQ don't use error dithering.
Now you have a grayscale image with 2 colors but it is not a bit image because the colors are not black and white but the 2 optimal ones.
3.- Convert to bit image without dithering.

Here you have the resulting bit image from lena

Image

The results could be enhanced playing with colors levels of the original image. Can you post your image ?
eL_PuSHeR
Posts: 267
Joined: Sat Apr 25, 2009 9:23 am

Re: Ximagic Quantizer

Post by eL_PuSHeR »

Thank you very much!. It's not a particular image. My goal is to test several halftoning/dithering methods for outputting images to my laser printer (b/w only). So far, Postscript (1200dpi) and Image Alchemy's Stevenson & Arce error-diffusion dither (600 dpi) get me the best results. Anyway, when text is present, I do not want to use any screen (like halftones do). Besides, using halftones tend to blur the image.

By the way, being able to play with LPI for halftones would be cool.
Intel i7 5960X
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
GeForce GTX 970 (Gigabyte)
eL_PuSHeR
Posts: 267
Joined: Sat Apr 25, 2009 9:23 am

Re: Ximagic Quantizer

Post by eL_PuSHeR »

I don't know why but the Lena image you posted looks okay. But for me, I have got only crappy results. I am posting here one image I used for testing but beware it's almost 800KB in size.

Image
Intel i7 5960X
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
GeForce GTX 970 (Gigabyte)
brodriguez
Posts: 64
Joined: Sun Feb 01, 2009 2:15 am

Re: Ximagic Quantizer

Post by brodriguez »

Here you have your image converted to bitimage using
1: The procedure I post previously.
2: The same procedure but using ordered dithering with pattern "Difussion 8x8" and levels 2,2,2 (without quantization)

I downscale the image using XNView to 25% before the process, and post it with it real size, because if the image is scaled after applying the dither, the dither became wrong.

ImageImage

If you view this image with XNView or other image viewer you can verify that the image changes depending on the zoom factor and sometimes can became really bad.

I suspect that your problem is that between the bitmap conversion and the printer there is some scaling which corrupt the dither.

Try printing the converted image with XNView with settings:
page layout = single scale
X Scale = 1
Y Scale = 1

Take into account that XNView will silently downscale the image to page size if it is greater than it.

I'm not aware of any bug in previous versions Ximagic Quantizer related with this process, but anyway verify you have the last version (1.63)

If you can't get those images with the plugin, please tell me, could be my instructions are wrong or there is some problem I don't know about.
eL_PuSHeR
Posts: 267
Joined: Sat Apr 25, 2009 9:23 am

Re: Ximagic Quantizer

Post by eL_PuSHeR »

Thank you very much. Here is the difference between Paint Shop Pro X b/w dither (stucki with an optimized palette) and SColorQ. In my opinion, Stucki is better (but not suitable for 600dpi printing, because you won't get a nice grayscale gradation. Pixels are too close to each other resulting in a darkened printout.) Better results are achieved using a Stevenson & Arde dithering (orthogonal screen error-diffusion).

SColorQ:

Image

PSP X Stucki dithering:

Image

PS - Anyway, your Ximagic Quantizer is very nice and has lot of potential.
Intel i7 5960X
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
GeForce GTX 970 (Gigabyte)
brodriguez
Posts: 64
Joined: Sun Feb 01, 2009 2:15 am

Re: Ximagic Quantizer

Post by brodriguez »

Thanks for your samples. :D

Analysing it I'd found a bug in the error dither with arrays, the results with Floyd or Stucki are far from what it must be. :(
I'd also found that the plugin need a fixed palette quantization for 1 bit conversions.

I've published a new version of the plugin (1.70) with:
- Error dither bug solved.
- % Error diffusion parameter (With diffusion less than 100% usually the results are better, with more contrast)
- Added fixed palette quantization (including 1-bit palette).

Now, to do the 1 bit conversion, the RGB->Grayscale->RGB conversion is not needed, but the results are better doing it.

I'm still working on this use case.
eL_PuSHeR
Posts: 267
Joined: Sat Apr 25, 2009 9:23 am

Re: Ximagic Quantizer

Post by eL_PuSHeR »

Thank you very much for your great efforts and good work!.

EDIT. Heh, your page says version 1.71 anyway. 8)

EDIT2. I made some tests using Riemersma and it did a wonderful work when printed on my laser printer. Chapeau! I am truly impressed.

By the way, this image is quite difficult to quantize, even increasing contrast. It's a PNG with transparency.

Image
Intel i7 5960X
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
GeForce GTX 970 (Gigabyte)
brodriguez
Posts: 64
Joined: Sun Feb 01, 2009 2:15 am

Re: Ximagic Quantizer

Post by brodriguez »

A good sample image. :wink:

I get some interesting results.

I added one sample page in the plugin web site with it:

http://www.ximagic.com/q_results_background.html

I've found that the result depends on the grayscale conversion used. I tests it using the conversion of GIMP and Photoshop. With the conversion of GIMP I get acceptable results, with the conversion of PS the gray level of the left upper circle is so near to white that there is not dither in it, if you put it on a white background it simply disappear, only with error diffusion greater than 100% the circle appear again.

I use the GIMP conversion for the samples.

I'd published another version of the plugin (1.80) adding Ulichney dithering, serpentine scan and allowing the error diffusion to be used also in riemersma.

Keep testing :D
eL_PuSHeR
Posts: 267
Joined: Sat Apr 25, 2009 9:23 am

Re: Ximagic Quantizer

Post by eL_PuSHeR »

I am impressed. I will continue testing, because I've found out that I get some nasty "bleeding effect" using Riemersma with latest version I got installed (1.71)

Thank you.
Intel i7 5960X
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
GeForce GTX 970 (Gigabyte)
brodriguez
Posts: 64
Joined: Sun Feb 01, 2009 2:15 am

Re: Ximagic Quantizer

Post by brodriguez »

Between v 1.70 and 1.71 I maked a change in the Riemersma dither.

There was a hidden parameter in the Riemersma dither, the queue size, which value change between v 1.70(=16) and v 1.71(=64) the result can be very different.

In the last version (v 1.81) I make the parameter visible and customizable with a default of 32.

I also updated the results page to show how this parameter modifies the result.

EDIT: The last version is 1.82. It solves a bug in fixed palette quantization.
Now conversion from RGB to 1 bit using YCbCr works and gives good results (apparently).
This conversion is different to a RGB-grayscale-1bit conversion because it don't remove color information before quantization.
eL_PuSHeR
Posts: 267
Joined: Sat Apr 25, 2009 9:23 am

Re: Ximagic Quantizer

Post by eL_PuSHeR »

Thanks. Updated.

Here's another image with transparency for testing (made from svg).

So far, I've found out that for images with solid colours (like the example below) is better to use a lower %error propation for Riemersma (=less dither). And for me, queue size = 64 seems better than 32 (maybe it's just my eyes).

More testing: It seems that a Riemersma filter with % error propagation = 90% and queue size = 32 yields the best results for photographic images printed on my Laserjet B/W. Your mileage may vary, I guess.

PS - After printing the same image about twenty times, I've come to the conclusion that you get the more accurate grays on a laser printer (b/w) using one of the ort halftones (and less banding than with the 45º ones) - Too bad image crispness isn't as good as without halftoning screens. I have been reading some documents about halftoning too, too bad I am not a programmer, but I have a question:

Have you heard about Direct Binary Search (DBS). I think it's meant for improving overall quality of error-diffusion dithered patterns. But it seems it has a very big computational hit, so I think nobody has implemented it yet (as far as I know).

Also, I have some suggestion about implementing a line art dither (clustered dither), using diagonal lines.

Image

Best regards.
Intel i7 5960X
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
GeForce GTX 970 (Gigabyte)