• Welcome to Vampyre Imaging Library Forum. Please login or sign up.
 

Saving JPEG2000

Started by kores, 12 November 2007, 20:43:05

Previous topic - Next topic

kores

Hello,

I'm using Vampyre Imaging Library Version 0.24.0 in my Delphi application.
I successfully open a jpeg 2000 (JP2) lossless compressed file (http://rapidshare.com/files/69263058/Original.jpg.html) using the following code:
  image := TSingleImage.Create;
  image.LoadFromFile(OpenDialog1.FileName);

When I save it (also lossless compression: Jpeg2000DefaultLosslessCompression = True) with the following code:  image.SaveToFile('c:\mac.jp2');

I get the following problems:
1.   The file size differs from the original
2.   If  I set Jpeg2000DefaultCodeStreamOnly = False then my image viewer program (XnView 1.80.3) fails to open it. The file is not the same anymore as the original. (however Vampyre Imaging Library can open the file). (Result file: http://rapidshare.com/files/69263385/CodeStreamFalse.jpg.html)
3.   If I set Jpeg2000DefaultCodeStreamOnly = True then the image is J2K not JP2, I need JP2.

What should I do to get an image exactly like the original one?
If you know the answer please help me.
Thank you.

Galfar

Looks like there is a problem with OpenJPEG (3rd party library that Imaging uses to load/save JPEG2000 images). It doesn't save color definition info in the file. That's no a problem if image has one or three (standard RGB) color channels, but four channel images (like the one you had problem with - doesn't matter if it is saved as lossy or lossless) are not loaded correctly by some (most) software.

I'm now adopting new version of OpenJPEG for Imaging 0.24.2. I'll let you know if it works with this one. 

Galfar

I'm waiting with the 0.24.2 release for new OpenJPEG major version 1.3 which should be released this week or the next one. After that it will take me few days to put the release together and test it.

Galfar

The official response from OpenJpeg team regarding color definition was:
"this is not planned in the near future... but contributions are welcome!"
So I will probably implement it in OpenJpeg myself when I have some time
but it won't be ready for Imaging 0.24.2 (which will be released today around midnight).

kores

Thank you for your answer. Too bad that they did not include this feature  :(
If you could implement that that would be great. Could you please give me an estimation on how long would it take (weeks, months) ?
Thanks again.

Galfar

I guess it wouldn't take more than one or two whole days of work. But I can't say
when I'll have that much free time because I've got a lot of other work to do right now and
this probably won't change until February :(

kores

Hello,

It is February :).
When will you have time to implement the Jpg2000 saving feature?
I really need that feature, and could not find any delphi library that could do the job.
If you cannot implement it till end of february then please let me know :(

Thank you

Galfar

I'll start working on it in the second half of February (next week?).
I'll let you know when it could be finished once I start
(when I know what exactly needs to be added/changed in OpenJPEG lib).

kores

Sounds great! Please let me know as soon as you find out something.
I need to know when to expect this feature so I can schedule the release date of my project.
If it will take a long time to implement it then I'll have to drop the jpeg2000 support, and I really don't want that :).
Thank you for your time and effort.

Best regards

Galfar

I'll have some free time this Friday & Saturday so I'll try to get it done.
I think that should be enough time (not yet 100% sure though).

Galfar

I've just finished adding CDEF handling to OpenJpeg library and updated Imaging to use it.
Updated files are now in SVN repository (I can send them to you by mail if you can't access SVN).

JP2 images with alpha saved by Imaging are now loaded properly by other applications (tested in PSP, IrfanView, XnView, ...).

kores

Thank you for helping me out.
Now it Jpeg2000 saving is working great ;D
You helped me a lot.

Best regards

Quick Reply

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Name:
Email:

Shortcuts: ALT+S save/post or ALT+P preview

SMF spam blocked by CleanTalk