#StackBounty: #image #scala #jvm How to create a black and white image of arbitrary size

Bounty: 50

I want to create an arbitrary large image consisting solely of black and white pixel. I am currently using BufferedImage. This, however, hits a hard limit at 65500 Pixel.

Exception in thread "main" javax.imageio.IIOException: Maximum supported image dimension is 65500 pixels
    at java.desktop/com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeImage(Native Method)
    at java.desktop/com.sun.imageio.plugins.jpeg.JPEGImageWriter.writeOnThread(JPEGImageWriter.java:1007)
    at java.desktop/com.sun.imageio.plugins.jpeg.JPEGImageWriter.write(JPEGImageWriter.java:371)
    at java.desktop/javax.imageio.ImageWriter.write(ImageWriter.java:613)
    at java.desktop/javax.imageio.ImageIO.doWrite(ImageIO.java:1628)
    at java.desktop/javax.imageio.ImageIO.write(ImageIO.java:1554)

How can I create an image of arbitrary size?

Bonus points: As the image is only black and white an efficient data format would be great.


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.