Skip to main content

[JAI] Re: Old style TIFF JPEG

4 replies [Last post]
Anonymous

Reply viewing options

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

You can try using the ImageIO class to create an ImageInputStream from
your file (either create a FileInputStream or do a URL.openStream to
pass to the ImageIO.createImageInputStream method()).

Then you can get an ImageReader from the
ImageIO.getImageReadersByFormatName() method. The string "tiff" can be
used as a parameter. The method will return an Iterator. Take the
first object in the Iterator and cast it to an ImageReader.

Then call the setInput() method on the ImageReader instance, passing in
the ImageInputStream you created. If you then call the read() method of
the reader, it will give you back a BufferedImage of the page you want

Code might look something like this:
try {
URL url = new URL();
ImageInputStream imageInputStream =
ImageIO.createImageInputStream(url.openStream());

// Hopefully the input is a TIFF, otherwise more logic is needed
here
ImageReader imageReader =

(ImageReader)ImageIO.getImageReadersByFormatName("tiff").next();
imageReader.setInput(imageInputStream);

int totalPages = imageReader.getNumImages(true);
int currentPage = 0;

BufferedImage image = imageReader.read(currentPage);
// Or even better...put it into a RenderedImage
} catch(Exception e) {
// something unexpected happened
}

That should be a good start.

-----Original Message-----
From: Mahesh Arumugam [mailto:marumuga@cs.wmich.edu]
Sent: Tuesday, June 28, 2005 3:07 PM
To: interest@jai.dev.java.net
Subject: RE: [JAI] Re: Old style TIFF JPEG

Jeff,

Thanks..Is there some sample code to look at?

Best regards,
Mahesh

Quoting Jeff Moroski :

> Yes. JAI by itself does not, but the JAI ImageIO library does.
>
> -----Original Message-----
> From: Mahesh Arumugam [mailto:marumuga@cs.wmich.edu]
> Sent: Tuesday, June 28, 2005 2:13 PM
> To: interest@jai.dev.java.net
> Subject: [JAI] Re: Old style TIFF JPEG
>
> Quoting Mahesh Arumugam :
>
> >
> >
> > Folks,
> >
> > Does ImageIO support decoding old style TIFF JPEG's? Can someone
>
> > throw some light on this?
> >
> > Best Regards,
> > Mahesh
> >
> >
>
>
>
> --------------------------------------------------------------------
-
> To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
> For additional commands, e-mail: interest-help@jai.dev.java.net
>
>
> --------------------------------------------------------------------
-
> To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
> For additional commands, e-mail: interest-help@jai.dev.java.net
>
>
>

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

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

Mahesh Arumugam

Quoting Mahesh Arumugam :

>
>
> Folks,
>
> Does ImageIO support decoding old style TIFF JPEG's? Can someone
> throw some light on this?
>
> Best Regards,
> Mahesh
>
>

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

Jeff Moroski

Yes. JAI by itself does not, but the JAI ImageIO library does.

-----Original Message-----
From: Mahesh Arumugam [mailto:marumuga@cs.wmich.edu]
Sent: Tuesday, June 28, 2005 2:13 PM
To: interest@jai.dev.java.net
Subject: [JAI] Re: Old style TIFF JPEG

Quoting Mahesh Arumugam :

>
>
> Folks,
>
> Does ImageIO support decoding old style TIFF JPEG's? Can someone
> throw some light on this?
>
> Best Regards,
> Mahesh
>
>

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

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

Mahesh Arumugam

Jeff,

Thanks..Is there some sample code to look at?

Best regards,
Mahesh

Quoting Jeff Moroski :

> Yes. JAI by itself does not, but the JAI ImageIO library does.
>
> -----Original Message-----
> From: Mahesh Arumugam [mailto:marumuga@cs.wmich.edu]
> Sent: Tuesday, June 28, 2005 2:13 PM
> To: interest@jai.dev.java.net
> Subject: [JAI] Re: Old style TIFF JPEG
>
> Quoting Mahesh Arumugam :
>
> >
> >
> > Folks,
> >
> > Does ImageIO support decoding old style TIFF JPEG's? Can someone
>
> > throw some light on this?
> >
> > Best Regards,
> > Mahesh
> >
> >
>
>
>
> --------------------------------------------------------------------
-
> To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
> For additional commands, e-mail: interest-help@jai.dev.java.net
>
>
> --------------------------------------------------------------------
-
> To unsubscribe, e-mail: interest-unsubscribe@jai.dev.java.net
> For additional commands, e-mail: interest-help@jai.dev.java.net
>
>
>

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