brightness and color value of image

im looking to create a program that can save the brightness and color value of a picture pixel by pixel left to right going down the rows and save all the values to a map. im wondering which would be the best library to use for this implementation. i will also have to be able to generate a image pixel by pixel and save it to a file
in standard RGB format the brightness is the value. That is, 0,0,0 is as black as the screen can get and 255 255 255 (or whatever for multi-byte colors) is as white as the screen can get. Then take green... 0,100,0 is a dark green, closer to black, while 0,255,0 is the brightest pure green.

the easy way to do all this is simply to save a file in the "raw" format which is size (height and width) followed by rgbrgbrgb.... for all the pixels. Boils down to an array of bytes that you just do a write(array, numbytes) to the file. you also have to decide if upper right or lower left is the first pixel.

why put it in a map? Again, an array/vector of bytes is probably better. Maps are not suitable here. If you must map it, keep the vector version also side by side, as you will want that I think.

dunno the best library. For this stuff, you don't need anything, but as soon as you want to compress the image to jpg or similar formats, you will want one. But to just create, modify, or dump an image, this is all you need. If the image is in another format, many programs can save the raw format for you.
Last edited on
im trying to allow a user to input a picture in any format into the program get all the pixel values and save them to an array (if you think that would be better) and be able to use these values to create a picture i do not want to just copy the file i want to pass the values into the array and pull them back out to create a image that is the same
ah. I don't have a current suggestion. I used to use the jpeg library (the actual code from the group is public) but that is dated and I don't know if they have retained and modernized the ability to open other file types. You could check it out.

Last edited on
Topic archived. No new replies allowed.