View multipage tiffs in SWT? [message #445262] |
Sun, 31 October 2004 05:34 |
Eclipse User |
|
|
|
Originally posted by: ukalumni.hotmail.com
I'm building a viewer that will load faxes received by a fax server.
Multipage faxes are saved as multipage tiffs. Is there some way to
handle this in SWT?
I need to alert the user if there is more than one page.
I need to be able to display the different pages.
I need to be able to delete individual pages.
I understand this may be beyond the scope of SWT, and if so, I'll use
ImageMagick to convert the tiffs to jpgs, which will separate the
multipage tiffs into individual jpgs.
However, if there is some way to do this in SWT, it would save me a
considerable amount of complexity.
Thanks,
--Michael
|
|
|
|
Re: View multipage tiffs in SWT? [message #445281 is a reply to message #445280] |
Mon, 01 November 2004 15:50 |
Eclipse User |
|
|
|
Originally posted by: ukalumni.hotmail.com
Christophe Cornu wrote:
> Hi Michael,
>
> SWT provides a baseline TIFF reader - it only reads the first image so this
> won't fit your needs.
> Please open a feature request (Bugzilla, SWT) and attach one of your TIFF
> files with multiple images. We can look into reading each TIFF subfile in
> the future.
>
> Thank you,
> Chris
>
>
Thanks very much for your response. As I said, I realize that is out of
scope for SWT, but I'll enter a feature request.
Thanks,
--Michael
|
|
|
Re: View multipage tiffs in SWT? [message #445412 is a reply to message #445262] |
Fri, 05 November 2004 11:25 |
Eclipse User |
|
|
|
Originally posted by: dominikg.vr-web.de
You can use the JAI (Java Advanced Imaging) Libraries from Sun.
http://java.sun.com/products/java-media/jai/index.jsp
Perhaps this code snippet will help you.
ArrayList images =3D new ArrayList();
File file =3D new File("C:\\test.tiff");
SeekableStream s =3D new FileSeekableStream(file);
TIFFDecodeParam param =3D null;
ImageDecoder dec =3D ImageCodec.createImageDecoder("tiff", s, param);
imageCount =3D dec.getNumPages();
String formatName =3D "JPG";
for (int i =3D 0; i < imageCount; i++) {
RenderedImage ri =3D dec.decodeAsRenderedImage(i);
ByteArrayOutputStream out =3D new ByteArrayOutputStream();
boolean writerExists =3D ImageIO.write(ri, formatName, out);
if (!writerExists) {
throw new IOException("Illegal ImageFormat: " + formatName);
}
ByteArrayInputStream in =3D new ByteArrayInputStream(out.toByteArray()=
);
images.add(new Image(parent.getDisplay(), in));
}
Dominik
Am Sun, 31 Oct 2004 00:34:58 -0500 schrieb Michael Molloy =
<ukalumni@hotmail.com>:
> I'm building a viewer that will load faxes received by a fax server. =
> Multipage faxes are saved as multipage tiffs. Is there some way to =
> handle this in SWT?
>
> I need to alert the user if there is more than one page.
> I need to be able to display the different pages.
> I need to be able to delete individual pages.
>
> I understand this may be beyond the scope of SWT, and if so, I'll use =
> ImageMagick to convert the tiffs to jpgs, which will separate the =
> multipage tiffs into individual jpgs.
>
> However, if there is some way to do this in SWT, it would save me a =
> considerable amount of complexity.
>
> Thanks,
> --Michael
-- =
Erstellt mit M2, Operas revolution=E4rem E-Mail-Modul: =
http://www.opera.com/m2/
|
|
|
Powered by
FUDForum. Page generated in 0.07671 seconds