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

  • SEARCH
  • Home
  • 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 6953819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:31:38+00:00 2026-05-27T14:31:38+00:00

I am working on a Survial game in java,and am working on map gen.

  • 0

I am working on a Survial game in java,and am working on map gen.
Im looking for a way to Make a Image of the maps.
I have a ArrayList of all the blocks,and would like to make it so if the block at 0,0 on the map if for example grass,I can set the pixel at 0,0 on this image to be green,and so on for the other blocks.

EDIT —-
as people are saying its unclear what Im trying to ask,this is the sort of image im talking about:

enter image description here

Where the dark green is the grass,the light green is trees,yellow is sand and blue is water.

  • 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-27T14:31:39+00:00Added an answer on May 27, 2026 at 2:31 pm
    private static void write(int id) {
            try {
                BufferedImage bi = ImageIO.read(new URL("http://xyz.com/abc.png"));
                BufferedImage bi2 = resizeImage(bi, bi.getType());
                Graphics g = bi2.getGraphics();
                g.drawString("Hello", 20, 20);
                ImageIO.write(bi2, "png", new File("out"+id+".png"));
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    
        private static BufferedImage resizeImage(BufferedImage originalImage, int type){
            BufferedImage resizedImage = new BufferedImage(400, 400, type);
            Graphics2D g = resizedImage.createGraphics();
            g.drawImage(originalImage, 50, 50, 248, 248, null);
            g.dispose();
            return resizedImage;
        }
    

    Above is an example snapshot from something i had used. Its just a prototype so needs refining. Basically you can build a buffered image in memory and write to file or put that image in another component such as jlabel.

    Once you have graphics reference you can pretty much use it as Canvas.

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

Sidebar

Related Questions

Working with some basic java apps on CentOS 5 linux and I have my
Working in Java: I have a JFrame class, and separate classes for my two
Working on game. I have a movable basket and a - for now -
Working on a project at the moment and we have to implement soft deletion
Working on an image gallery, but it keeps crashing on me (you control it
Working in the JBoss AS portlet we have been unable to open a jsp
Working in Xcode on Mac OS X Leopard in C++: I have the following
Working on a Online Test. I have 3 tables Questions Subject Topic I have
Working with MVC 2 ad with the help of some friends I thought all
Working with jquery.ajax for first time... I have a class in C#: public class

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.