Bug 362484

Summary: bad dotsPerMeter information for XCF files
Product: [Frameworks and Libraries] frameworks-kimageformats Reporter: Andrius <andriusmao>
Component: generalAssignee: Alex Merry <alex.merry>
Status: RESOLVED FIXED    
Severity: normal CC: aacid, cfeck, kdelibs-bugs, nate
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Other   
Latest Commit: Version Fixed In: 5.63
Sentry Crash Report:
Attachments: Sample XCF file

Description Andrius 2016-04-30 00:51:57 UTC
Images read through XCF plugin currently return weird values for QImage::dotsPerMeterX and QImage::dotsPerMeterY, e.g.:
DPM X:  -2147483648
DPM Y:  3937

example image attached (generated by GIMP 2.8)


Reproducible: Always

Steps to Reproduce:
1. Read an XCF image using QImageReader
2. get QImage::dotsPerMeterX() and QImage::dotsPerMeterY() values

Actual Results:  
DPM X:  -2147483648
DPM Y:  3937

Expected Results:  
DPM X:  72
DPM Y:  72
Comment 1 Andrius 2016-04-30 00:52:23 UTC
Created attachment 98691 [details]
Sample XCF file
Comment 2 Andrius 2016-04-30 00:54:37 UTC
just an amendment, for this example the expected results are:

DPM X: 2834
DPM Y: 2834
Comment 3 Christoph Feck 2016-04-30 03:51:23 UTC
From quickly checking the code, the QDataStream probably needs to use setFloatingPointPrecision(SinglePrecision), otherwise all floats are read in double precision.