Creating multi-page TIFF

Hi,
I am trying to create a multi-page TIFF from several .bmp files.
Here is my code:

public class AsposeImages {

public static void main(String[] args) throws FileNotFoundException {
String pathBase = “src\resources\”;
String[] srcFiles = {“DrawEllipseExample.bmp”, “DrawLinesExample.bmp”, “DrawRectangleExample.bmp”};

LicenseUtil.setLicense(“src\resources\license\Aspose.Total.Java.lic”);

TiffImage tiff = new TiffImage();
TiffOptions topt = new TiffOptions();

FileCreateSource src = new FileCreateSource(pathBase+“DrawShapesExample.tiff”);
topt.setSource( src);

for (short i = 0; i < srcFiles.length; i++) {

String fileName = pathBase + srcFiles[i];
RasterImage bmp = (RasterImage) Image.load(fileName);

TiffFrame frm = new TiffFrame(topt, bmp.getWidth(), bmp.getHeight());
Color[] pixels = bmp.loadPixels(bmp.getBounds());

frm.savePixels(frm.getBounds(), pixels);

tiff.addFrame(frm);

}

tiff.save(“src\resources\DrawShapesExample.tiff”, topt);

}
}

But I’ve got an error:

Exception in thread “main” java.lang.NegativeArraySizeException
at com.aspose.imaging.fileformats.tiff.y.(Unknown Source)
at com.aspose.imaging.fileformats.tiff.x.(Unknown Source)
at com.aspose.imaging.fileformats.tiff.TiffFrame.save(Unknown Source)
at com.aspose.imaging.internal.c.m.a(Unknown Source)
at com.aspose.imaging.Image.save(Unknown Source)
at com.aspose.imaging.Image.save(Unknown Source)
at asposeimages.AsposeImages.main(AsposeImages.java:46)

Meanwhile, when I tried with single .bmp file it is working:
String[] srcFiles = {“DrawEllipseExample.bmp”};

Can you provide an example how to create multi-page TIFF from several files in different format?
I am using aspose-imaging-1.8-jdk15.jar

Hi,

First of all, please accept our apologies for your inconvenience.

Sample code provided by you should work fine but it isn't producing the desirable results. I have experienced the same problem on my end while adding several frames in a tiff image, whereas the code works fine with one input image.

I have logged a ticket (IMAGING-33723) in our bug tracking system to investigate the problem cause and to provide a fix at earliest. Unfortunately, I do not have a workaround for this situation at the moment. As soon as I do, I will share here for your kind reference

The issues you have found earlier (filed as IMAGING-33723) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for JasperReports 18.3 update.