Re: EXIF support in PNG
John Bowler <[email protected]>
| Newsgroups | gmane.comp.graphics.png.general |
|---|---|
| Message-ID | <CAP7U399cnfPo6=-DtUBKxaku2d0gWL24m1a_=488fPHfVxd_4g@mail.gmail.com> |
On Mon, Jan 2, 2017 at 9:10 AM, Willem van Schaik <[email protected]> wrote: >here another argument in the "compression or not" debate >photo images stored in PNG is to replace RAW, which is >typically only used by high-end photographers Well, not just that; any image processing pipeline which uses digital camera image data and, for whatever reason, uses PNG as an intermediate format. PNG isn't a good replacement for RAW, but under some circumstances might be useful where JFIF hasn't enough range for the data. Ok, so I have a Sony RX-100 (the original one, actually it's a Hasselblad re-badge but it really is an RX-100). This camera has a setting where it records both a RAW file and an Exif file using JPEG compression. Taking just one image: DSC00552.ARW (RAW): 5504x3672, 21,021,184 bytes DSC00552.JPG (Exif): 5472x3648, 6,606,865 bytes The latter file has an APP1 Exif chunk (it really is an Exif file, not a JFIF one): APP1: Application marker [segment: 37566 bytes] Thumbnail length: 10608 bytes MakerNote length: 25717 bytes Remainder (by subraction): 1241 bytes In that file there is a second smaller (1616x1080) JPEG after the main one; I don't understand what that is. The full dump file is attached (this is from my own program and that isn't very up-to-date), I'm happy to upload the images to one of the binary dump sites. (They're copyright either me or my wife, I can't remember who took the photo, it's not very good ;-) Anyway even in the JPEG version the APP1 marker only takes 0.6% of the total and of the raw file that would be 0.2%. Meanwhile compressing the two files with 'gzip -c9' does the following: DSC00552.JPG 6606865 -> 6,584,713 [22152 bytes less] DSC00552.ARW 21,021,184 -> 20,818,660 [202,524 bytes less] and (using ImageMagick): DSC00552.JPG -> DSC00552.PNG: 21,447,864 bytes Compressed Exif profile size: 30,248 bytes Compressed MakerNote tag: 540 bytes (weird, a bug?) Uncompressed Exif profile size: 37,564 bytes (not 37566; no APP1 code) deflate(default) of Exif profile: 24,956 bytes gzip -9 of Exif profile: 25,303 bytes (has gzip header) So deflate of this profile reduces it to 83% of its original size, saving 12,608 bytes. Of course other cameras or even other photographs may produce different results; I suspect most of the compression here comes from the MakerNote. All the same, 60-80% compression is typical for deflate on byte-aligned data and very good for non-byte-aligned data like JPEG. Since any any likely image will be 1MPixel or more having 3MByte+ of RGB data PNG might on really good day reduce it o 1.5MByte I can't imagine there being any issue about lack of compression of the 40kByte or so of Exif APP1 data. -- John Bowler <[email protected]> +1 (541) 450-9885 PO BOX 3151 KERBY OR 97531-3151 USA ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ png-mng-misc mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/png-mng-misc
DSC00552.txt
(text/plain, 4.1 KB)
SOI: Start of image [marker]
APP1: Application marker [segment: 37566 bytes]
Exif(2.0 0)
little-endian
IFD[0] base: 8 entries: 12
ImageDescription ASCII[32] " [00]"
Make ASCII[11] "HASSELBLAD[00]"
Model ASCII[8] "Stellar[00]"
Orientation USHORT[1] TopLeft
XResolution URATIONAL[1] 350/1 [350]
YResolution URATIONAL[1] 350/1 [350]
ResolutionUnit USHORT[1] DPI
Software ASCII[14] "Stellar v1.00[00]"
DateTime ASCII[20] "2016:10:31 13:38:56[00]"
YCbCrPositioning USHORT[1] Co-sited
Exif IFD Offset ULONG[1] 288
UNKNOWN[50341] UNDEFINED[28]
IFD[1] base: 26686 entries: 13
Compression USHORT[1] JPEG
ImageDescription ASCII[32] " [00]"
Make ASCII[11] "HASSELBLAD[00]"
Model ASCII[8] "Stellar[00]"
Orientation USHORT[1] TopLeft
XResolution URATIONAL[1] 72/1 [72]
YResolution URATIONAL[1] 72/1 [72]
ResolutionUnit USHORT[1] DPI
Software ASCII[14] "Stellar v1.00[00]"
DateTime ASCII[20] "2016:10:31 13:38:56[00]"
JPEGInterchangeFormat (Thumbnail offset) ULONG[1] 26950
JPEGInterchangeFormatLength (Thumbnail length) ULONG[1] 10608
YCbCrPositioning USHORT[1] Co-sited
IFD[Exif] base: 288 entries: 37
ExposureTime[s] URATIONAL[1] 1/125 [0.008]
FNumber URATIONAL[1] 45/10 [4.5]
ExposureProgram USHORT[1] NormalProgram
ISOSpeedRating[ISO12232] USHORT[1] 800
UNKNOWN[34864] USHORT[1]
UNKNOWN[34866] ULONG[1]
ExifVersion "0230"
DateTimeOriginal ASCII[20] "2016:10:31 13:38:56[00]"
DateTimeDigitized ASCII[20] "2016:10:31 13:38:56[00]"
ComponentsConfiguration UNDEFINED[4] Y Cb Cr absent
CompressedBitsPerPixel URATIONAL[1] 2/1 [2]
Brightness[APEX] SRATIONAL[1] 10884/2560 [4.25156]19.0479footLambert(!)
ExposureBias[APEX] SRATIONAL[1] 0/10 [0]
MaxAperture[APEX] URATIONAL[1] 1110/256 [4.33594] f/4.4939
MeteringMode[255=other] USHORT[1] Pattern
LightSource[255=other] USHORT[1] unknown
Flash USHORT[1] ERROR: 16
FocalLength[mm] URATIONAL[1] 3285/100 [32.85]
MakerNote UNDEFINED[25717]
UserComment UNDEFINED[64] "[00][00][00][00][00][00][00][00][00][00][00]
[00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00]
[00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00]
[00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00][00]
[00][00]"
FlashPixVersion "0100"
ColorSpace USHORT[1] sRGB
PixelXDimension ULONG[1] 5472
PixelYDimension ULONG[1] 3648
UNKNOWN[40965] ULONG[1]
FileSource UNDEFINED[1] DigitalCamera
SceneType UNDEFINED[1] DirectCapture
UNKNOWN[41985] USHORT[1]
UNKNOWN[41986] USHORT[1]
UNKNOWN[41987] USHORT[1]
UNKNOWN[41988] URATIONAL[1]
UNKNOWN[41989] USHORT[1]
UNKNOWN[41990] USHORT[1]
UNKNOWN[41992] USHORT[1]
UNKNOWN[41993] USHORT[1]
UNKNOWN[41994] USHORT[1]
UNKNOWN[42034] URATIONAL[4]
APP2: Application marker [segment: 316 bytes]
DQT: Define quantization table [segment: 132 bytes]
DHT: Define Huffman tables [segment: 418 bytes]
SOF: Non differential Huffman; Baseline DCT [segment: 17 bytes]
SOF 5472x3648 8 bits per 3 components
component 0: 1 sampling: 2x1 Tq(0)
component 1: 2 sampling: 1x1 Tq(1)
component 2: 3 sampling: 1x1 Tq(1)
SOS: Start of scan [segment: 12 bytes]
EOI: End of image [marker]
skipped 1011 bytes
SOI: Start of image [marker]
APP1: Application marker [segment: 160 bytes]
Exif(2.0 0)
little-endian
IFD[0] base: 8 entries: 4
XResolution URATIONAL[1] 72/1 [72]
YResolution URATIONAL[1] 72/1 [72]
ResolutionUnit USHORT[1] DPI
Exif IFD Offset ULONG[1] 78
IFD[Exif] base: 78 entries: 2
PixelXDimension ULONG[1] 1616
PixelYDimension ULONG[1] 1080
DQT: Define quantization table [segment: 132 bytes]
DHT: Define Huffman tables [segment: 418 bytes]
SOF: Non differential Huffman; Baseline DCT [segment: 17 bytes]
SOF 1616x1080 8 bits per 3 components
component 0: 1 sampling: 2x1 Tq(0)
component 1: 2 sampling: 1x1 Tq(1)
component 2: 3 sampling: 1x1 Tq(1)
SOS: Start of scan [segment: 12 bytes]
EOI: End of image [marker]