Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6161889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T21:33:24+00:00 2026-05-23T21:33:24+00:00

I already asked a Question how to save large images and I think I’m

  • 0

I already asked a Question how to save large images and I think I’m on the right track but I still need some advice.

I have an Image 12000 x 12000 and I need to save it as .png

BufferedImage can’t be used.

I was already advised to use the RenderedImage interface but somehow I can’t get the desired result. ( I haven’t worked with rasters yet so probably I got something wrong )

Code for the saving image method:

   public static void SavePanel() {

    PanelImage IMAGE = new PanelImage(panel);

    try {
        ImageIO.write(IMAGE, "png", new File(ProjectNameTxt.getText() +  ".png"));
    } catch (IOException e) {
    }

   }

And code for the PanelImage class:

 public static class PanelImage implements RenderedImage {

    // some variables here

    public PanelImage(JImagePanel panel) {
       this.panel = panel;
    }

  public Raster getData(Rectangle rect) {

        sizex = (int) rect.getWidth();
        sizey += (int) rect.getHeight();
        image = null;
        image = new BufferedImage(
                (int) sizex,
                (int) sizey,
                BufferedImage.TYPE_INT_RGB);
        g2 = image.createGraphics();
        panel.paintComponent(g2);
        return image.getData();
    }

 // rest of the implemented methods - no problems here
 }

I noticed that the ImageIO requests one line of pixels at a time ( 12000 x 1 ).
This method is working but I still need the whole image in the BufferedImage.
I have to increase the size of the BImage each time ImageIO calls the method, otherwise I get ” Coordinate out of bounds! ” exeption

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T21:33:25+00:00Added an answer on May 23, 2026 at 9:33 pm

    This PNGJ library can be useful to read/write huge images, because it does it sequentially, it only keeps a line in memory at a time. (I wrote it myself a while ago, because I had a similar need)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I already asked similar question here, but I still get some errors, so I
Searching here I found that this question was already asked , but I think
this is (maybe) an already asked question... but i've some difficul to solve my
I've already asked this question, but I think I din't explain the problem well
I already asked this question at the JOS-.NET board but Joel is closing that
I've already asked this question on several forums, but without any good explanation of
I am sorry I have already asked this question on Superuser, but nobody answers
I already asked a similar question, PE Header requirements , but I'm not really
I've seen this question asked already - but none of the answers really gelled
I know a question like this was already asked, but the situation is a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.