我无法创建一个巨大的BufferedImage(内存不足不是问题)。有人有什么想法吗?
1. new BufferedImage(10000, 1000000, BufferedImage.TYPE_3BYTE_BGR);
1. new BufferedImage(10000, 1000000, BufferedImage.TYPE_3BYTE_BGR);
Exception in thread "main" java.lang.NegativeArraySizeException
at java.awt.image.DataBufferByte.<init>(DataBufferByte.java:42)
at java.awt.image.Raster.createInterleavedRaster(Raster.java:253)
at java.awt.image.BufferedImage.<init>(BufferedImage.java:368)
2. new BufferedImage(10000, 1000000, BufferedImage.TYPE_INT_RGB);
这段代码创建了一个宽度为10000像素,高度为1000000像素的RGB格式的缓冲图像。Exception in thread "main" java.lang.IllegalArgumentException: Dimensions (width=10000 height=1000000) 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)