Editing PPM

Hello everyone. I am a little into my way of programming. I have a question if anyone can help please. How do I change RGB values after opening an image? I tried using the method as if I were opening and editing a text file but it would not work. Here is a link to what I am talking about: http://imgur.com/H6EDFIq

I just want to change every third value (blue). I know I have to use a for loop, but I tried doing it as if I were editing a text file, but it just messed it up.

Any tips/help? Much appreciation. Thank you :)

Last edited on
closed account (2UD8vCM9)
You failed to mention what type of image file you are working with.

Each image format has a different data layout. You have to open it as a binary file instead of a text file and figure out which bytes you will be replacing to change the colors.
Last edited on
Topic archived. No new replies allowed.