Qt - Conversion JPEG to PNG not giving the same image
I would like to convert a jpeg image into png and to do so I am using the code below: QImageReader reader; reader.setFileName(imagePath); QImage image = reader.read(); QImageWriter writer; writer.setFileName(newImagePath); writer.write(image); I thought the output image would be exactly the same as the input one but the difference image is not null and I cannot figure out why. The difference image looks like a noise image with values ranging from -5 to 6. I tried to do the same thing with another librairy called VTK but I don't have the same problem, the image before and after compression are exactly the same. Any suggestion is welcome !
Different JPEG decoders can produce slightly different RGB values (more so if the JPEG contains a ICC profile); there a lot of numerical rounding and conversions involved (however, encoders are supposed to differ in no more than one bit per pixel from the reference implementation, but I would not bet on that; see eg this answer and this one). I suggest you try to do the pixel-by-pixel comparison inside QImage.
Extending namespace std with backported types and templates from newer C++ standards
What is address 0xbaddc0dedeadbead “Bad decode dead bead”
General Solution for classes in which copy constructor using default constructor
How to parse UTF-8 Chinese string
OpenCL returning -64 upon calling clGetPlatformIDs
Eclipse cdt debug quote error
How to stop main thread from another thread in c/c++
How can I use Blob Detector
C++ : for loop in a switch case
leveldb log_reader.h/Reader class design consideration
My linked lists program terminated with status -1073741819 In Code blocks compiler(x0000000005)) [closed]
Why does this double mutex lock not cause deadlock?
Helper function declaration outside class?
Auto declaration of map iterator error on GCC
Finding the length of a C style char * string in c++ [duplicate]
How to draw square on the button at the center using OpenGL?