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

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?

Categories

HOME
machine-learning
coldfusion
amazon-dynamodb
encryption
mongoose
freeswitch
linuxmint
glusterfs
gemfire
visio
sorm
m3u8
unity3d-unet
executable-jar
beatbox
odbc
pex
virtuoso
google-surveys
footable
heatmap
spacing
atom-feed
python-tesseract
radio
puma
aspose-cells
layer
lektor
spamassassin
database-theory
userfrosting
audiokit
gooddata
gemfile
rethinkdb-python
xunit.net
audiounit
dwt
smo
inputstreamreader
object-oriented-analysis
dependency-properties
implicit
nosuchelementexception
hasownproperty
collaborative-filtering
rpy2
helium
rate
swig-template
dex2oat
kendo-datepicker
typing
unreal-blueprint
listboxitem
bitcount
8085
busy-waiting
sin
angularjs-ng-options
eofexception
kirby
code-completion
irssi
like
httplib
componentkit
stacked-area-chart
option
textile
control-center
raii
rails-i18n
println
resourcedictionary
resharper-7.1
node-http-proxy
delphiscript
tandem
iunknown
pull-to-refresh
file-association
mysql-5.0
gwt-2.5
primefaces-extensions
utl-file
.lrc
generic-list
testdriven.net
umbraco5
visualtreehelper
spaces
windows-explorer
showmodaldialog
application-design
platform-independence
table-driven

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