using namespace std; #include #include #include "lodepng.h" int main(int argc, char *argv[]) { std::vector pixels; //the raw pixels unsigned width, height; //load and decode lodepng::decode(pixels, width, height, "in.png"); //increase brightness unsigned char image[width * height * 3]; for(unsigned y = 0; y < height; y++) for(unsigned x = 0; x < width; x++) { size_t byte_index = (y * width + x) * 3; image[byte_index] = (unsigned char)min(255, pixels[byte_index] + 30); image[byte_index + 1] = (unsigned char)min(255, pixels[byte_index + 1] + 30); image[byte_index + 2] = (unsigned char)min(255, pixels[byte_index + 2] + 30); } //encode and save lodepng::encode("out.png", image, width, height); }