Jump to content
  • Advertisement
Sign in to follow this  
superchritch

image editing

This topic is 5007 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi, i'm really new at image processing and i was hoping that someone here could teach me, or lend me any JAVA or C code which will allow me to edit an image pixel by pixel. i would really appreciate all the help i can get. thank you very much. p.s. this is for my undergraduate thesis... i nid help. thanks again.

Share this post


Link to post
Share on other sites
Advertisement
That's a bit confusing... if you just want to edit an image, use Paint Shop Pro or Photoshop or something.

If you want to learn to LOAD an image, goto nehe.gamedev.net and look though the tutorials until you find the one about loading BMP files (I'm pretty sure there is one in there).

As for code to allow for "editing", you will have to write that yourself, as it is a huge topic and the features to be included would be something of a personal decision.

(I suppose you could download the GIMP source).

Share this post


Link to post
Share on other sites
thanks. actually i nid a (java or c) code snippet because i will just be embedding that method into a larger system. i have just a implemented a skin color detection program and the output of that program is that it identifies each pixel as to whether it is under skin color or not. what i would like to do is to edit the same image that i used, convert all pixels that were determined to be skin into white and all the rest into black, is there any way to do that? thanks.

Share this post


Link to post
Share on other sites
What you need to learn is how to load and save an image file format. When you've loaded your image, the pixel data is simply stored in an array, so you can do whatever operations you want on the pixels simply by iterating through the array. Here's an overview of a load/edit/save system:

struct pixel_t {
byte red, green, blue;
};

struct image_t {
int width, height;
pixel_t *pixel_data;
};

image_t *load_image(const char *file)
{
image_t *image = new image_t;

//open the file, read in the info you need
//eg. width and height

image->pixel_data = new pixel_t[image->width*image->height];

//read the pixel data in from the file either directly into
//image->pixel_data (if the format permits), or by loading
//into a temporary buffer and copying into image->pixel_data
//pixel by pixel

return image;
}

void my_image_edit(image_t *image)
{
for(int i=0; i<(image->width*image->height); ++i) {
//do what you want with image->pixel_data
}
}

void save_image(const image_t *image, const char *file)
{
//open the file, write out the image
//in the format of the file
}


Hope that helps.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!