Ciao Fab, did you try to visualize your image before writing it down? Did yuo try with saving to another format?
Simone. ------------------------------------------------------- Ing. Simone Giannecchini GeoSolutions S.A.S. Owner - Software Engineer Via Carignoni 51 55041 Camaiore (LU) Italy phone: +39 0584983027 fax: +39 0584983027 mob: +39 333 8128928 http://www.geo-solutions.it http://geo-solutions.blogspot.com/ http://simboss.blogspot.com/ http://www.linkedin.com/in/simonegiannecchini ------------------------------------------------------- On Wed, Aug 19, 2009 at 11:52 AM, Fab Trillaud<[email protected]> wrote: > Here is what I do with more details : I work on an hexagonal grid I made to > process my data (this is an obligation due to my project, don't have > choice), and I've got the results of my processing drawn in a JPanel. So I > transform it into an image, than a BufferedImage, which I try to save in a > file. Here's my code: > > public static void exportToFile() > { > int width = > ((Double)villageGeometry.getEnvelopeInternal().getWidth()).intValue(); > int height = > ((Double)villageGeometry.getEnvelopeInternal().getHeight()).intValue(); > Image image = GridViewer.getJPanel().createImage(width, height); > BufferedImage img = MapTools.toBufferedImage(image); > try { > ImageIO.write(img, "tif", ShapeTools.promptImageFile("Fichier > TIF")); > } catch (IOException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > } > > public static BufferedImage toBufferedImage(Image image) { > if( image instanceof BufferedImage ) { > return( (BufferedImage)image ); > } else { > image = new ImageIcon(image).getImage(); > BufferedImage bufferedImage = new BufferedImage( > image.getWidth(null), > image.getHeight(null), > BufferedImage.TYPE_INT_RGB ); > Graphics g = bufferedImage.createGraphics(); > g.drawImage(image,0,0,null); > g.dispose(); > return( bufferedImage ); > } > } > > I get an image with the right dmensions, but containing nothing but a gray > background. > > Simone Giannecchini a écrit : >> >> Ciao Fab, >> as the message says, that is not an error but rather a warning which >> tells you that the native part of gdal is not installed. >> I am not sure how you are trying to save your raster data, anyway your >> problems should not be related to this message. >> If you provide me with more information on what you are doing I might >> try to investigare a bit further. >> >> Simone. >> >> ------------------------------------------------------- >> Ing. Simone Giannecchini >> GeoSolutions S.A.S. >> Owner - Software Engineer >> Via Carignoni 51 >> 55041 Camaiore (LU) >> Italy >> >> phone: +39 0584983027 >> fax: +39 0584983027 >> mob: +39 333 8128928 >> >> >> http://www.geo-solutions.it >> http://geo-solutions.blogspot.com/ >> http://simboss.blogspot.com/ >> http://www.linkedin.com/in/simonegiannecchini >> >> ------------------------------------------------------- >> >> >> >> On Wed, Aug 19, 2009 at 9:52 AM, Fab Trillaud<[email protected]> >> wrote: >> >>> >>> Hi, >>> >>> I'm working on a project using raster data, and I have to save my data >>> as image files with attached world files. So I'm using ImageIO to save >>> my image in TIF, but when it tries to create the file, I got this error : >>> >>> 19 août 2009 14:19:12 >>> it.geosolutions.imageio.gdalframework.GDALUtilities loadGDAL >>> ATTENTION: Native library load failed.java.lang.UnsatisfiedLinkError: no >>> gdaljni in java.library.path >>> >>> And the produced file is empty. >>> >>> Does anyone knows why it needs to use GDAL? Is there a way to simply >>> save the file with ImageIO?? How can I get rid of this error? >>> >>> Thanks ^^ >>> >>> Fab >>> >>> >>> ------------------------------------------------------------------------------ >>> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 >>> 30-Day >>> trial. Simplify your report design, integration and deployment - and >>> focus on >>> what you do best, core application coding. Discover what's new with >>> Crystal Reports now. http://p.sf.net/sfu/bobj-july >>> _______________________________________________ >>> Geotools-gt2-users mailing list >>> [email protected] >>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users >>> >>> >> >> >> ------------------------------------------------------------------------------ >> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 >> 30-Day trial. Simplify your report design, integration and deployment - and >> focus on what you do best, core application coding. Discover what's new with >> Crystal Reports now. http://p.sf.net/sfu/bobj-july >> _______________________________________________ >> Geotools-gt2-users mailing list >> [email protected] >> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users >> >> >> > > > ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Geotools-gt2-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
