Skip to main content

Accessing all resolutions in a JPEG2000 image

1 reply [Last post]
cowwoc
Offline
Joined: 2003-08-24

Hi,

Does this bug mean that it's impossible to access all resolutions inside a JPEG2000 image? http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6175316

For example if I open a JPEG2000 image in Photoshop it asks me which resolution I'd like to open it in: 1280x1024, 640x512, 320x256, 160x128, 80x64, or 40x32

Is it possible to:

1) Find out what resolutions exist?
2) Open an arbitrary resolution on demand?

The obvious benefit here is that I could get at a reduced-size resolution without having to scale the image.

Thank you,
Gili

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
cowwoc
Offline
Joined: 2003-08-24

I managed to access all resolutions using J2KImageReadParam.setResolution() and ImageReader.read(int, ImageReadParam) but in the process I found a bug in the documentation of J2KImageReadParam: http://java.sun.com/products/java-media/jai/forDevelopers/jai-imageio-1_...

The documentation for "resolution" reads "If the given index is greater than the number of available resolution levels of the compressed image, the decoded image has the lowest available resolution (among all tile-components)". In fact, it has been my experience that if the given index is larger than the maximum then the resulting resolution will be the largest, not the smallest as the documentation leads one to believe. I can't file a bug report because I don't (yet) have observer permission on the JAI-ImageIO project.

I have one last outstanding question: is there a way to find out the resolution of each "level" without decoding the entire image? The downside of the above approach is that ImageReader.read(int, ImageReadParam) decodes the entire image and only finds out the resolution of the level after the fact. There should be a cheaper way to do this.