Skip to main content

[JAI-IMAGEIO] Why do I get an empty TIFF from JPG

2 replies [Last post]
Anonymous

Hi together,

after years of absence I'm now again with JAI.
However, I need to load multiple JPG and store them
into a multi page tiff. It seems that I'm unable to
store tiff files.
First I thought I can not store multiple JPG in an
TIFF. Now I seem not to be able to store any JPG
in a tiff file. Can anyone tell me why?
I'm using daily builds.

This is my code:

public static final void main(String[] argv) {
ImageReader reader = null;
ImageWriter writer = null;
ImageWriteParam param;
try {
writer = getImageWriterByMime("image/tiff", new FileOutputStream("TestFile.tif"));
if (writer==null) {
throw new ImagingException("Format image/tiff not supported for input");
}
if (!writer.canWriteSequence()) {
throw new ImagingException("Format doesn't support multiple pages");
}
writer.prepareWriteSequence(null);
IIOImage image;
String inFile = new String[] { "TestIn1.jpg", "TestIn2.jpg" };
for (int i=0; i

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
mjacob@union06.de

Hi again,

I found out that with TIFF I have to flush the ImageOutputStream
and that flushing the underlying OutputStream is not enough.
So I need to hold the Reference to ImageOutputStream to flush it.

Is there a chance to "flush" the writer so I don't need
to move code from the getImageWriterByMime method to
the main method?

However it seems to be better code to work on the
top ImageOuputStream and not on the OutputStream.
But a flush method in the writer might be a nice
feature won't it?

Kind regards,
Marco

>However, I need to load multiple JPG and store them
>into a multi page tiff. It seems that I'm unable to
>store tiff files.
>First I thought I can not store multiple JPG in an
>TIFF. Now I seem not to be able to store any JPG
>in a tiff file. Can anyone tell me why?
>I'm using daily builds.

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

robert engels

call endWriteSequence().

On Mar 26, 2007, at 9:19 AM, mjacob@union06.de wrote:

> Hi again,
>
> I found out that with TIFF I have to flush the ImageOutputStream
> and that flushing the underlying OutputStream is not enough.
> So I need to hold the Reference to ImageOutputStream to flush it.
>
> Is there a chance to "flush" the writer so I don't need
> to move code from the getImageWriterByMime method to
> the main method?
>
> However it seems to be better code to work on the
> top ImageOuputStream and not on the OutputStream.
> But a flush method in the writer might be a nice
> feature won't it?
>
> Kind regards,
> Marco
>
>> However, I need to load multiple JPG and store them
>> into a multi page tiff. It seems that I'm unable to
>> store tiff files.
>> First I thought I can not store multiple JPG in an
>> TIFF. Now I seem not to be able to store any JPG
>> in a tiff file. Can anyone tell me why?
>> I'm using daily builds.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: interest-unsubscribe@jai-imageio.dev.java.net
> For additional commands, e-mail: interest-help@jai-
> imageio.dev.java.net
>

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