Author |
Topic |
|
richardc
United Kingdom
12 Posts |
Posted - Nov 26 2020 : 10:27:11
|
Hello,
We are attempting to use compression for jpeg 2000, we are predominately interested in 16 bit grayscale images, which JP2 supports.
Lossless seems to work fine, but setting the quality or rate seems to have poor results. I am taking a sample image (16bit grayscale tiff), converting it to JP2, then converting it back to a 16 bit tiff.
If I compare the original image, with the uncompressed version (by subtracting one from the other) then there is a noticeable grid pattern.
If I do the same with ImageMagick then the results are as expected, a very similar image with noise.
In this case I am using 95 quality, but 0.95 rate produces the same results unsurprisingly. 95 quality in ImageMagick produces a file of a different size interestingly, but adjusting the quality to roughly match the size just produces different levels of noise.
The code is very simple:
ImageEnView1.LegacyBitmap := False; ImageEnView1.IO.NativePixelFormat := True; ImageEnview1.IO.LoadFromFile('F:\HWSandstone\0000.TIF');
ImageEnView1.IO.Params.J2000_ColorSpace := TIOJ2000ColorSpace.ioJ2000_GRAYLEV; ImageEnView1.IO.Params.J2000_Quality := 95; ImageEnView1.IO.SaveToFileJP2('F:\HWSandstone\0000-100.jp2');
I am using ImageMagick to convert back to tiff, and compare although I have also tried ImageEn and it produces identical results.
This is the expected comparison:
This is the result from ImageEn:
This is with v9.2.6, although I recently upgraded from 8.7 to see if the problem had been fixed.
Thanks! |
|
xequte
38611 Posts |
|
richardc
United Kingdom
12 Posts |
Posted - Nov 30 2020 : 06:14:54
|
Thanks for the reply Nigel.
I assumed DLL because I made sure the DLL was in the same directory.
I wasn't aware of the setting, but I just changed:
IEGlobalSettings().JPEG2000Engine := ieenDLL;
Also printed out a debug message, and confirmed it was using the DLL.
The behaviour is the same, it is a 64bit app.
Thanks,
Richard |
|
|
xequte
38611 Posts |
Posted - Dec 01 2020 : 20:15:12
|
Hi Richard
I cannot reproduce that. Can you forward the source TIFF.
I think it is best to use J2000_Rate rather than J2000_Quality. At any rate, ensure you reset the other to 1.0/100.
Nigel Xequte Software www.imageen.com
|
|
|
richardc
United Kingdom
12 Posts |
Posted - Dec 02 2020 : 04:29:59
|
Thank you Nigel, I've sent it to you via email.
Richard |
|
|
|
Topic |
|