Ciao Albrecth, this is rather strange. I would recommend using the ImageIO tiff plugin explicitly everywhere rather than the com.sun.media.imageio.plugins.tiff one. Do this explicitly with imports of TIFFImageWriteParam, Check also the class of your writer and tells us the complete packages for it.
I suspect you are mixing sun tiff params with our writer. Best thing to do usually to get a proper TIFFImageWriteParam is to ask the writer to create one. Regards, Simone Giannecchini == Our support, Your Success! Visit http://opensdi.geo-solutions.it for more information. == Ing. Simone Giannecchini @simogeo Founder/Director GeoSolutions S.A.S. Via Poggio alle Viti 1187 55054 Massarosa (LU) Italy phone: +39 0584 962313 fax: +39 0584 962313 mob: +39 333 8128928 http://www.geo-solutions.it http://twitter.com/geosolutions_it ------------------------------------------------------- On Wed, Aug 29, 2012 at 5:19 PM, <[email protected]> wrote: > Hi all, > > recently i’m using gt libraries in my project to do some shapefile stuff. > After importing the necessary gt 9 snapshot libraries my tiff writer > compression in another class doesn’t work anymore. The function still writes > tiff files, but uncompressed. Here a snippet of the function I’m using to > write tiff files: > > > > import java.awt.Image; > > import java.awt.Graphics2D; > > import java.awt.RenderingHints; > > import java.awt.image.BufferedImage; > > import java.awt.image.ColorModel; > > import javax.imageio.stream.ImageOutputStream; > > import javax.imageio.ImageWriter; > > import javax.imageio.ImageWriteParam; > > import javax.imageio.ImageIO; > > import javax.imageio.IIOImage; > > import com.sun.media.imageio.plugins.tiff.TIFFImageWriteParam; > > > > File tiffFile = new File(filename); > > ImageOutputStream ios = null; > > ImageWriter writer = null; > > BufferedImage[] images > > > > // find an appropriate writer > > Iterator it = ImageIO.getImageWritersByFormatName("TIF"); > > if (it.hasNext()) { > > writer = (ImageWriter) it.next(); > > } else { > > return false; > > } > > > > ios = ImageIO.createImageOutputStream(tiffFile); > > writer.setOutput(ios); > > TIFFImageWriteParam writeParam = new > TIFFImageWriteParam(Locale.GERMAN); > > writeParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT); > > writeParam.setCompressionType("Deflate"); > > writeParam.setCompressionQuality(0.5f); > > //For more than one images > > writer.prepareWriteSequence(null); > > for (BufferedImage image : images) { > > writer.writeToSequence(new IIOImage(image, null, null), > writeParam); > > } > > writer.endWriteSequence(); > > > > Following geotools libraries are in my classpath: > > gt-api-9-SNAPSHOT.jar > > gt-coverage-9-SNAPSHOT.jar > > gt-cql-9-SNAPSHOT.jar > > gt-data-9-SNAPSHOT.jar > > gt-main-9-SNAPSHOT.jar > > gt-metadata-9-SNAPSHOT.jar > > gt-opengis-9-SNAPSHOT.jar > > gt-referencing-9-SNAPSHOT.jar > > gt-render-9-SNAPSHOT.jar > > gt-shapefile-9-SNAPSHOT.jar > > gt-swing-9-SNAPSHOT.jar > > jt-utils-1.2.0.jar > > jt-zonalstats-1.2.0.jar > > jts-1.12.jar > > jgridshift-1.0.jar > > imageio-ext-tiff-1.1.4.jar > > imageio-ext-utilities-1.1.4.jar > > miglayout-3.7-swing.jar > > xercesImpl-2.4.0.jar > > gt-epsg-hsql-9-SNAPSHOT.jar > > hsqldb-1.8.0.7.jar > > > > It sounds a little strange, but - is it possible that the imported jars have > influences on existing, formerly working libraries such as > > jai_codec.jar, jai_core.jar, jai_imageio-11.jar? > > > > Cheers > > Albrecht > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > GeoTools-GT2-Users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users > ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ GeoTools-GT2-Users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
