I already asked how to save large images, and I think I'm on the right track, but I still need some advice.
I have a 12000 x 12000 image and I need to save it as .png
BufferedImage cannot be used.
I have already been recommended to use the RenderedImage interface, but for some reason I can not get the desired result. (I have not worked with rasters yet, so I probably have something wrong)
Code for the method of saving images:
public static void SavePanel() { PanelImage IMAGE = new PanelImage(panel); try { ImageIO.write(IMAGE, "png", new File(ProjectNameTxt.getText() + ".png")); } catch (IOException e) { } }
And the code for the PanelImage class:
public static class PanelImage implements RenderedImage {
I noticed that ImageIO requests one row of pixels at a time (12000 x 1). This method works, but I still need the whole image in BufferedImage. I have to increase the size of BImage every time ImageIO calls a method, otherwise I get "Coordination Outside!" Exeption
thanks
Iccki
source share