You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by watte <wa...@gmail.com> on 2010/11/13 18:01:33 UTC

Dimensions are too large exception

I am trying to convert a wmf image into a jpg image, my code looks like
/*******code *******/
ImageInfo info = imageManager.getImageInfo(uri, sessionContext);
	            if(pictName.equals("image22.wmf")){
	            	info.getSize();
	        		String S = "PAWAN";
	        	}
	            
	            //Load image and request Graphics2D image
	            
	            g2dImage = (ImageBuffered)imageManager.
getImage(info, ImageFlavor.BUFFERED_IMAGE, 
sessionContext);
	            g2dImage.getBufferedImage().getHeight();
	            g2dImage.getRenderedImage().getHeight();
	            g2dImage.getSize().setSizeInPixels
(info.getSize().getWidthPx(), info.getSize().getHeightPx());
	            OutputStream os =
unit.getStreamProvider().createFile(pictName+".jpg");
	            ImageIO.write(g2dImage.getRenderedImage(), "jpg", os);
/*******end code***********/
while this works for half of the sample size that I have.
 For the other half, I get a "Dimensions are too 
large exception" exception, the stack trace is
/************** stack trace ************/
java.lang.IllegalArgumentException: Dimensions (width=851968 height=65536)
are too large
	at java.awt.image.SampleModel.<init>(SampleModel.java:112)
	at
java.awt.image.SinglePixelPackedSampleModel.<init>(SinglePixelPackedSampleModel.java:124)
	at java.awt.image.Raster.createPackedRaster(Raster.java:770)
	at java.awt.image.Raster.createPackedRaster(Raster.java:466)
	at
java.awt.image.DirectColorModel.createCompatibleWritableRaster(DirectColorModel.java:1015)
	at java.awt.image.BufferedImage.<init>(BufferedImage.java:315)
	at
org.apache.batik.transcoder.wmf.tosvg.AbstractWMFPainter.getImage(Unknown
Source)
	at org.apache.batik.transcoder.wmf.tosvg.WMFPainter.paint(Unknown Source)
	at
org.apache.fop.image.loader.batik.ImageConverterWMF2G2D$Graphics2DImagePainterWMF.paint(ImageConverterWMF2G2D.java:98)
	at
org.apache.xmlgraphics.image.loader.impl.ImageConverterG2D2Bitmap.paintToBufferedImage(ImageConverterG2D2Bitmap.java:149)
	at
org.apache.xmlgraphics.image.loader.impl.ImageConverterG2D2Bitmap.convert(ImageConverterG2D2Bitmap.java:74)
	at
org.apache.xmlgraphics.image.loader.pipeline.ImageProviderPipeline.execute(ImageProviderPipeline.java:175)
	at
org.apache.xmlgraphics.image.loader.pipeline.ImageProviderPipeline.execute(ImageProviderPipeline.java:99)
	at
org.apache.xmlgraphics.image.loader.ImageManager.getImage(ImageManager.java:227)
	at
org.apache.xmlgraphics.image.loader.ImageManager.getImage(ImageManager.java:294)
	at net.thirdwing.util.ImageUtils.copyImage(ImageUtils.java:73)
	/************** end stack trace ************/
I tried looking at AbstractWMFPainter's getImage method where I guess this
size is calculated. That code is way too complicated for me to understand
:(.
Is there a way to get this working or to downsize for large images?.
Thanks,
-Watte
-- 
View this message in context: http://old.nabble.com/Dimensions-are-too-large-exception-tp30208111p30208111.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org