NEF to PNG (PNG 6x larger file size)

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: NEF to PNG (PNG 6x larger file size)

Post by glennrp »

nitingeetasagar wrote:I was just experimenting In conversion from RAW format to jpeg,png and webp. So now only png is greater among the three. I just want to find out the reasons!! :?

So as PNG will be affected by Bayers filters which causes the mapping of 2 RGBG to a single RGB. Why its not doing the same in JPEG and WEBP?
It must be doing the same. JPEG and (as far as I know) WebP use RGB pixels. All three conversions start by decompressing and converting the Bayers pixels
to RGB pixels, which is a lossy operation and should result in an 18-MB file. Then PNG, JPEG, or WebP compression takes place. As noted elsewhere in
this thread, PNG compression isn't very effective for photographs, so the 18 MB only gets reduced to about 16 MB.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: NEF to PNG (PNG 6x larger file size)

Post by snibgo »

nitingeetasagar wrote:So as PNG will be affected by Bayers filters which causes the mapping of 2 RGBG to a single RGB. Why its not doing the same in JPEG and WEBP?
I'm not sure if you understand a fundamental point. Each camera pixel records either red, green or blue, at 12 or 14 bits. Demosaicing (de-Bayering) software guesses at missing values, converting each of these single-colour pixels into pixels with 3 colours, needing 24 or 48 bits. So if there is no compression at all, a NEF file will be smaller than a demosaiced file.
nitingeetasagar wrote:The project which I'm doing needs to prove that PNG, JPEG, WEBP are smaller than Raw image. But I'm stuck here on not sure what to submit in report!! :( :? :? :?
JPEG files can be smaller, eg by using "-quality 10". But you can't "prove" something that isn't generally true.
snibgo's IM pages: im.snibgo.com
Post Reply