0

I'd like to make a background that fits my game, A simple image, a black background with squares that are 56x56 pixels every 8 pixels, i can do the logic for this and draw it, but how do I save the image?

Or should I just draw the squares as the background within my game?

Example

  • 1
    http://stackoverflow.com/questions/8202253/saving-a-java-2d-graphics-image-as-png-file – Florian Schaetz Jul 29 '15 at 14:01
  • 1
    You simply create a BufferedImage, create a Graphics2D from that, paint to that and then store it via ImageIO. Should be simply enough, the question is, why? – Florian Schaetz Jul 29 '15 at 14:01
  • because its my game background, loading an image is neater than re-painting all those squares :P –  Jul 29 '15 at 14:03
  • Possibly true, but why do you have to save it in java and don't simply prepare it before? – Florian Schaetz Jul 29 '15 at 14:06
  • As in an external program, I could make it in photoshop but it would take a while where as I could create a for loop to place all the squares for me –  Jul 29 '15 at 14:09
  • Ah, ok, different program. In this case, BufferedImage, paint and ImageIO will suffice. – Florian Schaetz Jul 29 '15 at 14:13

0 Answers0