I have got a problem, In my program i get a image as the output, When ever i save that image in any of the file formats, and then reopen the image using imread all its pixel values are changed.How can i save my image while preserving its pixel values
1 view (last 30 days)
Show older comments
Can anyone please tell me a way to save my image while preserving its pixel value.
0 Comments
Answers (2)
Walter Roberson
on 11 Jul 2015
To prevent the values from changing, use an output format that does not use compression or which uses lossless compression. In particular, by default JPEG uses lossy compression and the values change for JPEG unless you tell it to turn compression off. Consider using TIFF files.
Image Analyst
on 11 Jul 2015
I recommend using PNG format, though TIFF and BMP will also be OK. Definitely don't use JPEG.
3 Comments
Image Analyst
on 12 Jul 2015
uint8 is what I always use for saving images (it gives the maximum portability to other programs). I'm not sure if those formats can accept floating point data in any range. If you're not going to use the image in any other program, then save the variable to a .mat file. Otherwise you'll have to look up the proper parameters to tell it to save as floating point TIFF or PNG (if that is allowed).
Image Analyst
on 16 Jul 2015
KUNAL JOG, can you upload some data and code that proves what you say, because it just doesn't sound right?
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!