difference in treatment/support of Jpeg vs PNG?
Added by M Fioretti over 8 years ago
Greetings,
I am restructuring my digital photograph management flow. In this context I have to decide whether to stick to Jpg or use PNG for archival. The question for this forum is if there is any difference in how exiv2 handles metadata in Jpg vs png. In other words, can it do with metadata in Jpeg files all it can do with png files, and vice-versa? If I save metadata in a PNG file with, say, digiKam, which uses exiv2, and then a friend asks for a jpg version, will it have exactly the same metadata when I convert it inside digiKam?
From what I have already read around, the answer would seem "yes", but I'd really appreciate a confirmation from expert exiv2 developers and users.
TIA,
Marco
Replies (9)
RE: difference in treatment/support of Jpeg vs PNG? - Added by Robin Mills over 8 years ago
Marco
Thanks for visiting the forum. I'm a little disappointed that nobody has answered your question because .... I don't know the answer. Perhaps the DigiKam or a photographer's forum is a better place to ask. Some place where photographers discuss work-flow. I had a Google into this matter and concluded that JPG-metadata is not equal to PNG-metadata. Of course, you can do some experiments in DigiKam with the format convertors.
Most desktop and mobile software accept PNG and JPG images in a transparent manner. Sure, they display and recompress the images, however the preservation and use of metadata is variable. For example, you maybe be very unpleasantly surprised to discover that something that produces a beautiful web-album from JPG simply doesn't do the same job when given PNG.
I personally use JPG because the cameras produced that format. One day, I'm going to start shooting RAW images to get away from JPG artifacts. So, I'll almost certainly adopt Adobe's DNG format which provides a single container type for the myriad of manufacturer's raw formats. Adobe provide a free-download of a convertor to create DNG. I believe Canon's EOS cameras can create JPG and CRW (canon raw) at the same time.
I'm not saying "Adopt DNG". I'm saying that when I decide to move away from JPG (for quality reasons), I intend to adopt DNG. However I will move cautiously.
Robin
RE: difference in treatment/support of Jpeg vs PNG? - Added by M Fioretti over 8 years ago
Hi Robin, thanks for your reply.
The digiKam mailing list is exactly where I got the suggestion to ask here.
This because my question is about exiv2 itself, internally, never mind for just a moment what software is using this library: can exiv2 do, i.e. read/write to the SAME level (whatever that level is) to PNG and JPG files?
"JPG-metadata is not equal to PNG-metadata": what does this mean, exactly? Do you have links to pages that you already found, and I could study?
Wrt to DNG, I am in the same situation as you right now. I have to reorganize, tag, geotag, edit... thousands of JPG pictures that often need editing, and/or paper photographs or negatives to scan, to Jpg or PNG I don't know yet. That's why I am trying to know if, how far as metadata are concerned, there are gotchas and differences in how exiv2 deals with PNG vs JPG. Right now I have no RAW pictures to take care of.
Thanks.
RE: difference in treatment/support of Jpeg vs PNG? - Added by Robin Mills over 8 years ago
Marco
I found something last week about PNG metadata in PNG and I thought "this isn't exif". I believe there are segments in the PNG which contain arbitrary data. I've just had a google for "compare png jpg metadata" and came up with:
http://en.wikipedia.org/wiki/Exchangeable_image_file_format
About exif, it says "It is not supported in JPEG 2000, PNG, or GIF."
You can look up PNG and XMP on Expedia. I believe the Adobe XMP initiative was to give a uniform structure to all metadata across all formats.
Your question has made me think "how does PNG actually store metadata and is there a 1-to-1 mapping for every exif tag?".
I didn't write exiv2 and have never needed to debug that part of the code. That's why I said "I don't know the answer". One day, I'll investigate and update this thread with more information.
Robin
RE: difference in treatment/support of Jpeg vs PNG? - Added by arron lee over 8 years ago
JPEG is an image compression standard and coding system. It was created by the Joint Photographic Experts Group committee in 2000 with the intention of superseding their original discrete cosine transform-based JPEG standard (created in 1992) with a newly designed, wavelet-based method. Progressive transmission by pixel and resolution accuracy, commonly referred to as progressive decoding and signal-to-noise ratio (SNR) scalability: (JPEG 2000: http://www.yiigo.com/support/kb/formats/jpeg/) provides efficient code-stream organizations which are progressive by pixel accuracy and by image resolution (or by image size). This way, after a smaller part of the whole file has been received, the viewer can see a lower quality version of the final picture. The quality then improves progressively through downloading more data bits from the source. The 1992 JPEG standard also has a progressive transmission feature but it's rarely used.The aim of JPEG 2000 is not only improving compression performance over JPEG but also adding (or improving) features such as scalability and editability. In fact, JPEG 2000's improvement in compression performance relative to the original JPEG standard is actually rather modest and should not ordinarily be the primary consideration for evaluating the design. Very low and very high compression rates are supported in JPEG 2000.
PNG (Portable Network Graphics: http://www.yiigo.com/support/kb/formats/png/) is raster graphics file format that supports lossless data compression. PNG was created to replace Graphics Interchange Format (GIF) and Tagged Image File Format (TIFF) and add some functionality that GIF does not have.
Unlike other image file format, PNG supports 256 colors palette-based images with a relatively small file size; RGB, RGBA and Grayscale image with or without alpha channel; 1-48 bit True-color image and 1-16 bit grayscale image; gamma adjustment; storing image name, writer, version, time, annotation and more; and lossless data compression method known as DEFLATE.
There are many differences between them. But we can get the formats whatever we want using a fine 3rd party image converter tool. You can google what youwant. I hope you success. Good luck.
RE: difference in treatment/support of Jpeg vs PNG? - Added by Tuan Nhu over 8 years ago
The metadata in JPG and PNG are stored in the different ways, so exiv2 handles them differently.
There is a short wiki about the metadata in JPG at http://dev.exiv2.org/projects/exiv2/wiki/The_Metadata_in_JPEG_files
For PNG, you can read it at http://www.libpng.org/pub/png/spec/1.2/png-1.2.pdf
In general, when we convert from JPG to PNG, the metadata may be lost or may not recognize properly by different decoders. It is because some metadata is supported by JPG, but not PNG. For example, Exif info is supported by JPG, but PNG does not embed EXIF info. However, PNG can still store metadata (in Chunks) which include some EXIF data (e.g. physical dimension, timestamp), and also permits arbitrary textual data as key=value pairs. So, we could in principle store any EXIF information in our own custom format. This is just a trick and not a standard way. Hence, our Exif info in PNG may not be recognized in some decoders.
RE: difference in treatment/support of Jpeg vs PNG? - Added by Gilles Caulier over 8 years ago
I would to add a comment here about PNG, as i written PNG metadata handling in Exiv2.
In fact all metadata from JPEG are preserved in PNG. The way to do it is simple and used in ImageMagick : whole Exif, IPTC, and XMP data are stored in a dedicated PNG compressed text chunk and save as ASCII.
Typically if you use imagemagick command line tool to convert a JPEG file to PNG and go back :
convert foo.jpg foo.png
convert foo.png foo2.jpg
... foo.jpg and foo2.jpg have the same Exif, Iptc, and Xmp metadata. NOTHING is lost.
Note:
- for XMP, a standardized way exist through Adobe specification. This way is used to store XMP in PNG (it use a dedicated chuck, not a compressed text chuck)
- JPEG2000 and PGF use a similar way to store Exif, Iptc, and XMP.
In all case, nothing is lost, but this can be invisible in some image management software.
Gilles Caulier
Gilles Caulier
RE: difference in treatment/support of Jpeg vs PNG? - Added by Susanna Moore over 7 years ago
The actual exif metadata as such may be carried within different host formats, e.g. TIFF, JFIF (JPEG) or PNG. Actually, PNG does not embed EXIF info. It allows, however, to store metadata ("Chunks") which include some EXIF data (physical dimension and timestamp), and also permits arbitrary textual data as key=value pairs. So, you could in principle store any EXIF information... but in your own custom format. When converting from JPEG(http://www.rasteredge.com/formats/jpeg/) to PNG(http://www.rasteredge.com/formats/png/), the information will be lost.
RE: difference in treatment/support of Jpeg vs PNG? - Added by diskover diskover over 4 years ago
I shoot only RAW as I prefer what I get from post process. I could add JPEG but it is always a bit dull because I have my settings set to prioritize RAW shooting with my histogram as accurate as possible for RAW. The histogram shows based on your JPEG ( https://www.cleverfiles.com/howto/what-is-jpg.html ) settings so I set me JPEG settings to optimize my histogram for RAW (Based on suggestions from Rico's book). I have seen it recommended to shoot both and did for a while, but I just found it is better to optimize my settings for one or the other.
RE: difference in treatment/support of Jpeg vs PNG? - Added by dell merca over 4 years ago
PNG is a good choice for storing line drawings, text, and iconic graphics at a small file size. By converting a PNG file to JPEG you can save a lot of space, most of the time between 50-70%, which might be ideal if you are dealing with dozens or hundreds of images. However, if the focus is on image quality , PNG is certainly the best format.
JPEG's ability to reduce file size up to 15% without losing quality makes it useful for web pages especially for colorful photos. Unfortunately, JPGs don't support transparency . JPG files have an unlimited color palette, but they blend pixels together to reduce the size of the image. While PNG is more suitable for the web, JPEG is still the preferred format when it comes to photos and digital art.
More on....[[PNG Vs JPG http://net-informations.com/q/mis/jpgng.html ] ]