Skip to main content

ImageIO Plug-in Help

7 replies [Last post]
tyler_c
Offline
Joined: 2006-09-28

I have created both a ImageIO reader and writer plug-in. Both have been deployed are work as they should for those type of images that it reads. My problem lies in when I need to read other types of random images.

Iterator imageReaders = ImageIO.getImageReaders(iis);

ImageReader ir = imageReaders.next();

This will always return two readers, my custom plug-in and then the built in ImageIO reader for that type. So say the image I am trying to read is a png, it will return "my custom reader" and "png". It always uses my custom one first.

How does ImageIO decide which reader to use based on the ImageInputStream it gets?

Is this something that I need to code in my plug-in so it limits it to the specific type I need?

Any help would be great, thanks.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Brian Burkhalter

Check, e.g., this file:

https://jai-imageio-core.dev.java.net/source/browse/jai-imageio-core/src...

I assume you have a plug-in wrapper for Kakadu ...

On Thu, 28 Sep 2006, jai-imageio@javadesktop.org wrote:

> Yea, I think that makes sense now that I think about it. Another quick question. Is there any easy way to tell if the image is JPEG2000 then? Because I want this plug-in to only be able to read JPEG2000 images.

----------------
Brian Burkhalter
Java Media, Imaging, and Graphics
Sun Microsystems, Inc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

tyler_c
Offline
Joined: 2006-09-28

Well actually I am using a plug-in wrapper for Aware, but that link should help me out greatly. Thanks.

Brian Burkhalter

Has your ImageReaderSpi implementation correctly implemented this?:

http://java.sun.com/j2se/1.5.0/docs/api/javax/imageio/spi/ImageReaderSpi.html#canDecodeInput(java.lang.Object)

Brian

On Thu, 28 Sep 2006, jai-imageio@javadesktop.org wrote:

> I have created both a ImageIO reader and writer plug-in. Both have been deployed are work as they should for those type of images that it reads. My problem lies in when I need to read other types of random images.
>
> Iterator imageReaders = ImageIO.getImageReaders(iis);
>
> ImageReader ir = imageReaders.next();
>
> This will always return two readers, my custom plug-in and then the built in ImageIO reader for that type. So say the image I am trying to read is a png, it will return "my custom reader" and "png". It always uses my custom one first.
>
> How does ImageIO decide which reader to use based on the ImageInputStream it gets?
>
> Is this something that I need to code in my plug-in so it limits it to the specific type I need?
>
> Any help would be great, thanks.
> [Message sent by forum member 'tyler_c' (tyler_c)]
>
> http://forums.java.net/jive/thread.jspa?messageID=157894
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-imageio.dev.java.net
>
>

----------------
Brian Burkhalter
Java Media, Imaging, and Graphics
Sun Microsystems, Inc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

tyler_c
Offline
Joined: 2006-09-28

All of that is setup correctly, or what I see as correct. Maybe my assumption that ImageIO would use the suffix name to determine if it can read it or not, is wrong. The two functions that I did not implement fully are canDecodeInput and getImageWriterSpiNames. Could this be my problem?

Brian Burkhalter

Did I send the wrong link? I think canDecodeInput() is the problem.

Brian

On Thu, 28 Sep 2006, jai-imageio@javadesktop.org wrote:

> All of that is setup correctly, or what I see as correct. Maybe my assumption that ImageIO would use the suffix name to determine if it can read it or not, is wrong. The two functions that I did not implement fully are canDecodeInput and getImageWriterSpiNames. Could this be my problem?
> [Message sent by forum member 'tyler_c' (tyler_c)]
>
> http://forums.java.net/jive/thread.jspa?messageID=157904
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-imageio.dev.java.net
>
>

----------------
Brian Burkhalter
Java Media, Imaging, and Graphics
Sun Microsystems, Inc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net

tyler_c
Offline
Joined: 2006-09-28

Yea, I think that makes sense now that I think about it. Another quick question. Is there any easy way to tell if the image is JPEG2000 then? Because I want this plug-in to only be able to read JPEG2000 images.

Brian Burkhalter

Yes, the stream has to start with either an SOC marker segment or a JPEG 2000
Signature Box depending on whether it's a raw JPEG2000 codestream or stored in
the JP2 file format.

Brian

On Thu, 28 Sep 2006, jai-imageio@javadesktop.org wrote:

> Yea, I think that makes sense now that I think about it. Another quick question. Is there any easy way to tell if the image is JPEG2000 then? Because I want this plug-in to only be able to read JPEG2000 images.
> [Message sent by forum member 'tyler_c' (tyler_c)]
>
> http://forums.java.net/jive/thread.jspa?messageID=157917
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-imageio.dev.java.net
>
>

----------------
Brian Burkhalter
Java Media, Imaging, and Graphics
Sun Microsystems, Inc.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This email message is for the sole use of the intended recipient(s)
and may contain confidential and privileged information. Any
unauthorized review, use, disclosure or distribution is prohibited.
If you are not the intended recipient, please contact the sender by
reply email and destroy all copies of the original message.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

---------------------------------------------------------------------
To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
For additional commands, e-mail: interest-help@jai-imageio.dev.java.net