0

I have an array of point coordinates. The data is too large and does not allow me to create one BufferedImage, so I would like something like the following.

To create the first BufferedImage take the 100 first lines. Then the loop starts again, but create a new BufferedImage with the lines that range from 101 to 200… do this until the loop reaches the end of the array.

int temp = 100;

while (listPing.size() < temp) {
  // Do something
  // Create BufferedImage
  temp = temp * 2;
}

How would I do this?

Bernhard Barker
  • 54,589
  • 14
  • 104
  • 138
  • Parts of an image are called **tiles**. ImageIO can read an image, but can also provide an ImageReader which is adaptable, for instance to only read a tile. http://stackoverflow.com/questions/26139065/how-to-read-a-tiff-file-by-tiles-with-java – Joop Eggen Jun 18 '15 at 14:58

1 Answers1

0

I'm not quite sure I got to understand what you meant, but I think the way you're looking for is as follows:

int total = listPing.size(); //calculate the total number lines in here
int temp = 100; //stepsize
int actualValue = 0;

while(actualValue < total) {
    Do something
    Create BufferedImage
    actualValue += temp;
}

Another possibility would be to previously calculate the number of times you'd go through, by dividing total size / stepsize, and then creating a for loop.

Keews
  • 249
  • 2
  • 15