I am merging a group of tiff images into one and at the same time want to resize/rescale the final tiff image in java . Is there a way to do that . Below was my logic for merging . I am successfully in merging but can't increase the height and width .
ByteArrayOutputStream baos=new ByteArrayOutputStream();
//ImageEncoder encoder = ImageCodec.createImageEncoder("tiff", baos, params);
List<BufferedImage> imageList = new ArrayList<BufferedImage>();
for (int i = 1; i < images.size(); i++)
{
imageList.add(resizedImage);
}
params.setCompression(params.COMPRESSION_NONE);
params.setExtraImages(imageList.iterator());
TIFFField[] extras = new TIFFField[2];
extras[0] = new TIFFField(282, TIFFField.TIFF_RATIONAL, 1, (Object) new long[][] { { (long) 300, (long) 1 },
{ (long) 0, (long) 0 } });
extras[1] = new TIFFField(283, TIFFField.TIFF_RATIONAL, 1, (Object) new long[][] { { (long) 300, (long) 1 },
{ (long) 0, (long) 0 } });
params.setExtraFields(extras);
ImageEncoder encoder = ImageCodec.createImageEncoder("tiff", baos, params);
encoder.encode(images.get(0));
baos does holds the bytes for the final image which i am converting into a tiff
Final steps of creating a combined tiff image
FileOutputStream fos = new FileOutputStream (new File(inputDir + "\\combined.tiff"));
baos.writeTo(fos);
But how to increase the height and width . Please make a note that i had done everything in the java code and all at the run time