Ximagic Quantizer
Moderators: XnTriq, helmut, xnview
-
- Posts: 267
- Joined: Sat Apr 25, 2009 9:23 am
Re: Ximagic Quantizer
I've tried version 2.3.
I've come to the conclusion that error-diffusion is of no use for simulating grayscale screens for printer resolutions > 300dpi. The pixels are so close to each other that images suffer from contrast excess. Unless you use an hexagonal grid, like the one Stevenson & Arce provides, it's better to use some ordered dither. At least, DBS is working better, but I still have got a somewhat darkened output overall. 45º ordered/Ulichney, gives a very nice output if you tinker enough with resolution/LPI. For a 1200dpi capable monochrome laser like mine, you can get some very nice outputs using a 16x16 grid, which yields you the full 256 grayscale spectrum at 75 LPI. I dare to say that quality is even slighty better than the one PostScript provides, that usually prints better than PCL.
I've also tested the colour quantizer for decreasing colour depth from true colour to 256c (a document I had previously scanned), and combining Wu quantization + Riemersma dither gave me almost no noticeable visual difference.
Keep up the good work!
Best regards.
I've come to the conclusion that error-diffusion is of no use for simulating grayscale screens for printer resolutions > 300dpi. The pixels are so close to each other that images suffer from contrast excess. Unless you use an hexagonal grid, like the one Stevenson & Arce provides, it's better to use some ordered dither. At least, DBS is working better, but I still have got a somewhat darkened output overall. 45º ordered/Ulichney, gives a very nice output if you tinker enough with resolution/LPI. For a 1200dpi capable monochrome laser like mine, you can get some very nice outputs using a 16x16 grid, which yields you the full 256 grayscale spectrum at 75 LPI. I dare to say that quality is even slighty better than the one PostScript provides, that usually prints better than PCL.
I've also tested the colour quantizer for decreasing colour depth from true colour to 256c (a document I had previously scanned), and combining Wu quantization + Riemersma dither gave me almost no noticeable visual difference.
Keep up the good work!
Best regards.
Intel i7 5960X
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
GeForce GTX 970 (Gigabyte)
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
GeForce GTX 970 (Gigabyte)
-
- Posts: 267
- Joined: Sat Apr 25, 2009 9:23 am
Re: Ximagic Quantizer
Hello.
I had a problem when using GrayDither on a big image (13225 x 8851 pixels grayscale). Is it a plugin boundary error or anything else?
I have 3 GB RAM.
I had a problem when using GrayDither on a big image (13225 x 8851 pixels grayscale). Is it a plugin boundary error or anything else?
I have 3 GB RAM.
Intel i7 5960X
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
GeForce GTX 970 (Gigabyte)
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
GeForce GTX 970 (Gigabyte)
-
- Posts: 64
- Joined: Sun Feb 01, 2009 2:15 am
Re: Ximagic Quantizer
Hello
I'm not aware of such limit, but I've not tested the plugin with nothing of this size.
I've created a grayscale sample of this size and tested it (I've 5GB and Vista x64)
It seems there are some kind of memory leak, most probably two of it.
With Threshold dithering the first run succeed but the second fails, and with error dithering the first and second runs succeed but the third fails.
Is this the problem you've found
I'm now working on performance improvements and preview. I expect to publish new versions tomorrow but I'll delay the versions until I've solved those leaks.
Keep testing
I'm not aware of such limit, but I've not tested the plugin with nothing of this size.

I've created a grayscale sample of this size and tested it (I've 5GB and Vista x64)
It seems there are some kind of memory leak, most probably two of it.

With Threshold dithering the first run succeed but the second fails, and with error dithering the first and second runs succeed but the third fails.
Is this the problem you've found

I'm now working on performance improvements and preview. I expect to publish new versions tomorrow but I'll delay the versions until I've solved those leaks.
Keep testing

-
- Posts: 267
- Joined: Sat Apr 25, 2009 9:23 am
Re: Ximagic Quantizer
It's probably a memory leak of some kind. The plugin just exits on me with an unknown error.
And while doing some more tests I have found out that I was mistaken about one thing: I was basing gamma correction for alleviate dot gain on printed resolution. It seems it's better to base gamma on LPI, that is, halftone/screen frequency. I am now getting more consistent results (as far as tone/brightness is concerned).
Best regards.
And while doing some more tests I have found out that I was mistaken about one thing: I was basing gamma correction for alleviate dot gain on printed resolution. It seems it's better to base gamma on LPI, that is, halftone/screen frequency. I am now getting more consistent results (as far as tone/brightness is concerned).
Best regards.
Intel i7 5960X
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
GeForce GTX 970 (Gigabyte)
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
GeForce GTX 970 (Gigabyte)
-
- Posts: 64
- Joined: Sun Feb 01, 2009 2:15 am
Re: Ximagic Quantizer
I'm sure someone could benefit from your experience if you publish it.eL_PuSHeR wrote:And while doing some more tests I have found out that I was mistaken about one thing: I was basing gamma correction for alleviate dot gain on printed resolution. It seems it's better to base gamma on LPI, that is, halftone/screen frequency. I am now getting more consistent results (as far as tone/brightness is concerned).

I've published a new version (2.40) with preview, and memory and speed enhancements. In the new version, when there is a problem of memory allocation, the user will receive a message from the plugin.
I've tested GrayDither with some huge graylevel test images and it seems it depends on the host memory usage and of course the free memory in the computer. In fact to make the plugin work in PS I need to reduce the configurable memory usage os PS to 512MB. Even when there is free memory in the system, this memory could be fragmented and it is not posible to allocate contiguous areas with enough size.
I've only tested up to 11264 * 11264 (=126877696 / 123 MB) which is slightly greater than your test image (13225 * 8851 = 117054475 / 114.3 MB).
- XnView - Ok
IrfanView - 6144 * 6144 max (with an image of 8192 * 8192 the plugin can't allocate memory and with 11264 * 11264 the program crash)
GIMP - Ok
PS - Ok

I hope the new version solves your problem.

-
- Posts: 267
- Joined: Sat Apr 25, 2009 9:23 am
Re: Ximagic Quantizer
It doesn't work for me even if memory usage reported by my image is 114MB.
+ Under Paint Shop Pro X I get a "Can't allocate memory" error.
+ Same under XnView.
+ Irfanview just exits to desktop without warning.
I have some programs running in the background. I will restart my PC and try again later.
EDIT: Rebooting made no effect. It's odd because Windows reports a memory usage of 217MB and almost 3GB free. I will keep testing.
EDIT2: I made some changes but to no effect. This is my free ram as reported by windows Task Manager

EDIT3: Plugin GUI appeared one of the times I tried but the preview was totally messed up and the resulting file (45x45 Ulichney + 2 levels) had 148 colours instead of 2. How weird!
After that, invoking the plugin again gets me the "cannot allocate memory" error.
+ Under Paint Shop Pro X I get a "Can't allocate memory" error.
+ Same under XnView.
+ Irfanview just exits to desktop without warning.
I have some programs running in the background. I will restart my PC and try again later.
EDIT: Rebooting made no effect. It's odd because Windows reports a memory usage of 217MB and almost 3GB free. I will keep testing.
EDIT2: I made some changes but to no effect. This is my free ram as reported by windows Task Manager

EDIT3: Plugin GUI appeared one of the times I tried but the preview was totally messed up and the resulting file (45x45 Ulichney + 2 levels) had 148 colours instead of 2. How weird!
After that, invoking the plugin again gets me the "cannot allocate memory" error.
Intel i7 5960X
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
GeForce GTX 970 (Gigabyte)
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
GeForce GTX 970 (Gigabyte)
-
- Posts: 64
- Joined: Sun Feb 01, 2009 2:15 am
Re: Ximagic Quantizer
Hi
New version 2.41. This time I tested it also with Photo-Paint running on XP with 1GB and it works.
There are still problems in XnView and IrfanView.
Xn don't crash but the preview and the results are wrong.
IV still crash.
I'll still analyzing IV and XN problems, but I publish the version ASAP to allow you to test it with PSP.
New version 2.41. This time I tested it also with Photo-Paint running on XP with 1GB and it works.

There are still problems in XnView and IrfanView.
Xn don't crash but the preview and the results are wrong.
IV still crash.
I'll still analyzing IV and XN problems, but I publish the version ASAP to allow you to test it with PSP.

-
- Posts: 267
- Joined: Sat Apr 25, 2009 9:23 am
Re: Ximagic Quantizer
Thanks. I will try it and post tomorrow.
I tested it now. It doesn't work at all: unknown error reported by PSP when tried to run it.
Under XnView it works but the preview is wrong and it generates a 148 grayscale for 2 levels.
The image I am testing takes up about 103 MB in memory, according to PSP image information.
I tested it now. It doesn't work at all: unknown error reported by PSP when tried to run it.
Under XnView it works but the preview is wrong and it generates a 148 grayscale for 2 levels.
The image I am testing takes up about 103 MB in memory, according to PSP image information.
Intel i7 5960X
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
GeForce GTX 970 (Gigabyte)
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
GeForce GTX 970 (Gigabyte)
-
- Posts: 64
- Joined: Sun Feb 01, 2009 2:15 am
Re: Ximagic Quantizer
I've found and corrected a small error in the preview code, but apparently this error can't crash the plugin. (v 2.42)
If the width of a grayscale image is greater than 13224 then the information the plugin gets from XnView is wrong
The limit 13224 hasn't any sense for me but is what I get from my tests. I don't test if the same limit apply to the height.
I test it not only with my plugin but also with Harry's filters and the result is the same, the preview is wrong and also the result.
Can you make a test cutting your image to 13224 x 8851 ?
I will try to test it with PSP, but I need to know which version are you using.eL_PuSHeR wrote:I tested it now. It doesn't work at all: unknown error reported by PSP when tried to run it.

What I found about XNView is really weird. I'd posted the bug to the bug forum.eL_PuSHeR wrote:Under XnView it works but the preview is wrong and it generates a 148 grayscale for 2 levels.
If the width of a grayscale image is greater than 13224 then the information the plugin gets from XnView is wrong

The limit 13224 hasn't any sense for me but is what I get from my tests. I don't test if the same limit apply to the height.
I test it not only with my plugin but also with Harry's filters and the result is the same, the preview is wrong and also the result.
Can you make a test cutting your image to 13224 x 8851 ?
-
- Posts: 267
- Joined: Sat Apr 25, 2009 9:23 am
Re: Ximagic Quantizer
Good day. I am using Corel Paint Shop Pro X (10.00 from 2005)
My yesterday tests were made using a smaller image (12xxx X hhhh). The image took up about 99 MB of memory.
I will try your suggestion of 13224 x 8851.
Hang on.
Well, tested it at that resolution. No difference under PSP (unknown error occured)
I've noticed some very weird behaviour under XnView. This time it worked at (13224 x 8851) but CPU seemed to go crazy for a few seconds (I heard un unpleasant sound from the cpu fan) when loading image (although CPU usage seemed to be between 25-33%), and memory usage went from 550 MB+ (I had several programs opened, Total commander, Seamonkey and Opera) to 1790 MB+
Anyway, it worked properly. Resulting image was right and with 2 colours.
My yesterday tests were made using a smaller image (12xxx X hhhh). The image took up about 99 MB of memory.
I will try your suggestion of 13224 x 8851.
Hang on.
Well, tested it at that resolution. No difference under PSP (unknown error occured)
I've noticed some very weird behaviour under XnView. This time it worked at (13224 x 8851) but CPU seemed to go crazy for a few seconds (I heard un unpleasant sound from the cpu fan) when loading image (although CPU usage seemed to be between 25-33%), and memory usage went from 550 MB+ (I had several programs opened, Total commander, Seamonkey and Opera) to 1790 MB+
Anyway, it worked properly. Resulting image was right and with 2 colours.
Intel i7 5960X
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
GeForce GTX 970 (Gigabyte)
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
GeForce GTX 970 (Gigabyte)
-
- Posts: 267
- Joined: Sat Apr 25, 2009 9:23 am
Re: Ximagic Quantizer
Further tests did not succeed. I also tested it on my work's computer, just to be on the safe side. Same behaviour as mine.
On PSP10 I got the infamous "unknown error occured with command Ximagic_GrayDither" or "not enough memory to process..."
On the other hand, I have another suggestion for you: Would it be too difficult to include title and plugin version somewhere? maybe on a corner.
On PSP10 I got the infamous "unknown error occured with command Ximagic_GrayDither" or "not enough memory to process..."
On the other hand, I have another suggestion for you: Would it be too difficult to include title and plugin version somewhere? maybe on a corner.
Intel i7 5960X
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
GeForce GTX 970 (Gigabyte)
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
GeForce GTX 970 (Gigabyte)
-
- Posts: 64
- Joined: Sun Feb 01, 2009 2:15 am
Re: Ximagic Quantizer
This match more or less with the expected memory allocation (1138 MB) = two copies of grayscale data (2 * 114 MB) and two copies of the information as RGB (2 * 457 MB)brodriguez wrote:I've noticed some very weird behaviour under XnView. This time it worked at (13224 x 8851) but CPU seemed to go crazy for a few seconds (I heard un unpleasant sound from the cpu fan) when loading image (although CPU usage seemed to be between 25-33%), and memory usage went from 550 MB+ (I had several programs opened, Total commander, Seamonkey and Opera) to 1790 MB+
I was working on how the error is reported and found there was two mistakes, and the plugin don't behave as expected when an allocation fails.eL_PuSHeR wrote:Further tests did not succeed. I also tested it on my work's computer, just to be on the safe side. Same behaviour as mine.
On PSP10 I got the infamous "unknown error occured with command Ximagic_GrayDither" or "not enough memory to process..."
I've corrected it in v 2.43 but the allocated memory is the same that in v 2.42, so you will not be able to process the image although now the plugin don't crash and the errors are reported clearer.
Now I'm working to decrease the memory requirements, I expect in the next version to need more or less a half of what is actually needed.
OK to the suggestion. The plugin name is in the window title but the version is not and depending on the plugin host you use it could difficult or impossible to get it. I'll put the version also in the window Title.eL_PuSHeR wrote:On the other hand, I have another suggestion for you: Would it be too difficult to include title and plugin version somewhere? maybe on a corner.
-
- Posts: 267
- Joined: Sat Apr 25, 2009 9:23 am
Re: Ximagic Quantizer
Thank you very much.
Intel i7 5960X
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
GeForce GTX 970 (Gigabyte)
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
GeForce GTX 970 (Gigabyte)
-
- Posts: 64
- Joined: Sun Feb 01, 2009 2:15 am
Re: Ximagic Quantizer
I published v 2.44, now the memory needed for grayscale processing is about 60% of the previous needs.
I've tested this version also with PSP X2.
I hope now it works with your test images.

I've tested this version also with PSP X2.
I hope now it works with your test images.

-
- Posts: 267
- Joined: Sat Apr 25, 2009 9:23 am
Re: Ximagic Quantizer
It now works properly, YAY! It loads a lot faster too.
Great work!
Great work!
Intel i7 5960X
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
GeForce GTX 970 (Gigabyte)
Gigabye GA-X99-Gaming 5
8 GB DDR4 (2100)
GeForce GTX 970 (Gigabyte)