skip to Main Content

I need to create a very large image in java and so far I’ve been using the java.awt.image.BufferedImage class. But it seems that this class stores it’s pixels with an int as it can not go past 2^31 pixels. I’ve thought about creating smaller images and stitching them together, but the problem is the photo editors I try like Adobe Photoshop can’t even import photos larger than 30,000 pixels in any dimension.

I’ve thought about making my own image class but I am not knowledgeable enough to make everything to go into that.

Any suggestions?
Thank You

2

Answers


  1. Chosen as BEST ANSWER

    I found out that GIMP is able to import photos that are 2^31 or less in any dimension so I'm able to stitch together photos with this. Thank you to everyone that responded.


  2. You’ll probably struggle to load an image of that size memory because the memory footprint of an image of 2^31 x 1px would be:

    2^31px * 1px * 4 bytes/px = 4,294,967,296 bytes = ~4.2 GB
    

    A 2^31px x 4px image would already consume more memory than most computers have. Stitching the images together is the correct design for such a situation. A simple solution would be to keep a multidimensional array of images and load them in and out of memory based on your requirements.

    ImageMagick is a mature utility for processing images, and it can support very large image sizes. Since you say you want to write a large image file, I would suggest using the montage feature. Render parts of your fractal and save them to disk, then once rendering is finished, invoke the ImageMagick montage command from your program to generate the final large file.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search