Saturday 15 March 2014

c++ - CImg saving images changes values? -


So I'm using the CIMG library, which has some fun with images ... the issue is that when When I open a file, change its RGB values ​​and save it, the modified image does not contain changed values ​​or the original value.

  CIMG & lt; Unsigned four & gt; Image_out (img.c_str ()); Image_out (0,0,0) = 253; // New RGB values ​​image_out (0,0,1) = 248; Image_out (0,0,2) = 251; Image_out.save ("out.jpeg");  

Then when I open the image again, then I get it as new RGB values ​​...

  R: 24 9G : 24 9B: 24 9 I do not really understand why the values ​​set by me are not being saved ... 

Edit: Sorry, pixels (in relation to RGB) are 255, 255, 255.

Do not use JPG, it is a destructive image format which does not preserve values ​​due to DCT compression Does. Use PNG or Bmp instead.


No comments:

Post a Comment