I have a problem saving large images (e.g. 12,000 x 9,000).
I am developing graphic editing software (something like simple Photoshop) and the User should obviously be able to save the image.
Suppose I would like to save the image as .png. Should JAVA always use BufferedImage to save drawn materials?
I know the equation for the image size: Xsize * Ysize * 4 (red, green, blue, alpha) Thus, in this case we get more than 400 MB.
I know that I can save the image in parts (tiles), but the user will still have to combine them.
Is there any other way to save such a large image without using BufferedImage?
Code for saving the image:
public static void SavePanel() { BufferedImage image = null; image = new BufferedImage( (int) (Main.scale * sizeX ), (int) (Main.scale * sizeY ), BufferedImage.TYPE_INT_RGB); g2 = image.createGraphics(); panel.paint(g2); try { ImageIO.write(image, "png", new File(FactoryDialog.ProjectNameTxt.getText() + ".png")); } catch (IOException e) { } }
Thank you in advance!
Iccki
source share