Skip to main content

filestore operation and size of file

1 reply [Last post]
kinkadzs
Offline
Joined: 2007-12-11

Hi everybody. My program has to read a tiff image, modify it and save it. Using JAI everything runs fine, but i don't understand why the original file is 2Mb in size and the modified one is almost 25 Mb.

What am I doing wrong?

This is how I get the tiff into a renderedImage:

//read the image
RenderedImage image = JAI.create("fileload", filename);

//modify it
PlanarImage img = PlanarImage.wrapRenderedImage(image);
ColorModel colorModel = img.getColorModel();
Raster r=img.getData();
WritableRaster raster = (WritableRaster) r;
int[] rgb = new int[3*150*1700];
for ( int i = 0; i < 3*1700*150; i++ ) {
rgb[i] = 255;
}
raster.setPixels(100, 3280, 1700, 150, rgb);
BufferedImage bi = new BufferedImage(colorModel,raster,colorModel.isAlphaPremultiplied(),null);

//save it
String filename = "C:\\modif.tif";
String format = "TIFF";
RenderedOp op = JAI.create("filestore", image, filename, format);

Do I need to use some kind of compression? Any suggestion is welcome, Thank you!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kinkadzs
Offline
Joined: 2007-12-11

Don't know why it didn't post all the message, to finish it ,

[b]//...continuing modify [/b]
raster.setPixels(100, 3280, 1700, 150, rgb);
BufferedImage bi = new BufferedImage(colorModel,raster,colorModel.isAlphaPremultiplied(),null);

[b]//save it[/b]
String filename = "C:\\modif.tif";
String format = "TIFF";
RenderedOp op = JAI.create("filestore", image, filename, format);

[b]Do I need to use some kind of compression? Any suggestion is welcome, Thank you.[/b]