c++


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.

Related Links

Returning array of character error in c++?
returning MPI DataType to MPI Gather
Lua/Luabind: Objects constructed by objects remain allocated
How to override standard C++ functions when testing in Visual Studio?
function definition does not declare parameters simple c++ programme [closed]
Install System C to Cygwin
pointer to static as template parameter / instantiate a template using a c string
visual studio fatal error LNK1120:
sourceModel property in QSortFilterPtoxyModel - Need to understand this code
Using types defined in class
getting “Unhandled exception” error after applying canny edge detector using opencv /c++
Editing a specific row in txt file using C++ [closed]
Static controls slightly flicker when main window is resized
Fibonacci - Divide and conquer algorithm [closed]
Handle “Out-of-Gamut” Color in RGB to CIEL*a*b* to RGB Conversions
Opengl show vertex in 2d or 3d

Categories

HOME
c++
google-maps-api-3
.net-core
jsoup
masonry
screensaver
netlogo
statistics
sendmail
appium
set
logistic-regression
conditional
aws-codepipeline
import
q-learning
android-animation
fluent-assertions
css-modules
navbar
logstash-grok
video.js
sdl
accelerometer
react-boilerplate
httpsession
polymer-1.0
media
cookie-session
github-api
http-caching
z80
protobuf-c
vim-syntax-highlighting
nexmo
neoscms
regex-negation
lsmeans
tablet
spamassassin
initializing
google-nearby
webex
data-compression
configuration-files
gemfile
multibox
roc
react-d3
sqlitestudio
terminal-emulator
coupling
django-compressor
oltp
google-keep
erwin
satellite
self-referencing-table
sharepoint-userprofile
mapfragment
compass
devpartner
nsolid
groovy-eclipse
user-mode-linux
arrangeoverride
javascript-globalize
dynamics-nav-2009
meter
authentication-flows
apache-roller
cleartool
tokumx
orca
syntactic-sugar
angularjs-ng-show
start-stop-daemon
bonjour
maptiler
println
complete.ly
ubuntu-13.04
gideros
apprequests
ereg
mdbtools
jnetpcap
slimv
jsonexception
ruby-on-rails-plugins
converters
wymeditor
plcrashreporter
mono-service
juggernaut
iphone-3gs
viewexpiredexception
visual-programming
laconica
pvcs
astoria

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App