ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 JP2 compression issues
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

richardc

United Kingdom
12 Posts

Posted - Nov 26 2020 :  10:27:11  Show Profile  Reply
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

38128 Posts

Posted - Nov 27 2020 :  13:31:26  Show Profile  Reply
Hi

Are you using ielib or native loading?

https://www.imageen.com/help/TIEImageEnGlobalSettings.JPEG2000Engine.html

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

richardc

United Kingdom
12 Posts

Posted - Nov 30 2020 :  06:14:54  Show Profile  Reply
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
Go to Top of Page

xequte

38128 Posts

Posted - Dec 01 2020 :  20:15:12  Show Profile  Reply
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
Go to Top of Page

richardc

United Kingdom
12 Posts

Posted - Dec 02 2020 :  04:29:59  Show Profile  Reply
Thank you Nigel, I've sent it to you via email.

Richard
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: