Open Lychengit opened 1 year ago
jvm:-Xmx600m
demo:
public static void main(String[] args) throws IOException {
ImageInputStream iis = ImageIO.createImageInputStream(new File("D:\\fcs\\test\\test6\\test.jpeg")); Iterator<ImageReader> readers = ImageIO.getImageReaders(iis); if (!readers.hasNext()) { throw new RuntimeException("No suitable ImageReader found for source data."); } ImageReader reader = readers.next(); reader.setInput(iis, true, true); ImageReadParam irp = reader.getDefaultReadParam(); irp.setSourceRegion(null); irp.setSourceSubsampling(2, 2, 0, 0); BufferedImage image; try { image = reader.read(0, irp); } catch (Exception e) { // wrap and rethrow any exceptions throw new IOException("Could not read JPEG 2000 (JPX) image", e); } ImageIO.write(image, "jpeg", new File("D:\\fcs\\test\\test6\\1.jpeg")); }
image file: test.zip
The source file is in the zip archive, please unzip it and test it
I also can't control the overflow point using subsampling
Is there any way to fix this overflow point
jvm:-Xmx600m
demo:
public static void main(String[] args) throws IOException {
image file: test.zip