• Please use real names.

    Greetings to all who have registered to OPF and those guests taking a look around. Please use real names. Registrations with fictitious names will not be processed. REAL NAMES ONLY will be processed

    Firstname Lastname

    Register

    We are a courteous and supportive community. No need to hide behind an alia. If you have a genuine need for privacy/secrecy then let me know!
  • Welcome to the new site. Here's a thread about the update where you can post your feedback, ask questions or spot those nasty bugs!

Image size reporting in IrfanView

Doug Kerr

Well-known member
IrfanView is a very capable and convenient image file viewer. It can work seamlessly in tandem with IrfanView Thumbnails, a nice file "browser" with a quick response.

The other day, as I contemplated the possibility that it was about time for me to use the raw outputs of my cameras for important works, I did a survey of how various tools available to me responded to the raw files out of my cameras (in the Canon CR2 format) and as well transcriptions of these files into the "universal raw" form, DNG files, made from the CR2 files by Adobe DNG Cnverter.

I the process I learned some interesting (and in some cases, repulsive) things about the various tools.

I found that IrfanView, as I had it configured (with the various necessary plugins) was more than happy to display nicely the images held by CR2 files from two of my camera systems and the DNG files generated from those by Adobe DNG Converter.

As I worked with this, I almost my accident discovered that, in the Information report IrfanView will display for the current file, the image size reported for a raw file was substantially different from what I expected. For example, with respect to a shot with my Canon PowerShot G16, set to deliver a JPG file of an image with pixel dimensions 4000 × 3000, for the CR2 file also emitted by the camera, IrfanView reported image pixel dimensions of 1600 × 1200. For the DNG file generated from that CR2 file, IrfanView reported pixel dimensions of 1024 × 768.

I sent a note to Irfan Skiljian, the developer of IrfanView, telling him of my observations, and questioning whether this might be an anomaly in the working of IrfanView. (Irfan is a fine fellow, always glad to discuss with me my thoughts and questions about IrfanView and related topics.)

The resulting exchange of notes was very enlightening.

Irfan first reminded me that typically a raw file contains, in addition to the "raw" representation of the image, an embedded "preview image", in JPEG form, usually with pixel dimensions somewhat less than those of the image represented by the raw data (but not a "tiny" image, such as the "thumbnail" image typically embedded in a JPG file).

It seems that IrganView, in its default ("factory") configuration, when dealing with a raw file that includes such a preview image, extracts it and uses it as the basis for its onscreen display. This of course eliminates the time required to "develop" the image before it can be shown.

The pixel dimensions of these preview images are generally large enough that a nice onscreeen presentation of the image is given.

And in fact, in such a case, IrfanView reports, as the image size for the file, the dimensions of the image IrfanView uses for the display. Thus the dimensions I saw reported as described above.

Irfan reminded me that the user who did not find this approach desirable could easily set, in the Preferences panel, one of two alternate modes:

• To ignore any embedded JPG preview image but rather to develop the raw data into an image, which is then used by IrfanView for display.

• To develop from the raw data, when possible, a "half-size" image (quicker than developing the image at full resolution), which is then used by IrfanView for display.

Now here is where it gets interesting. The "sensel grid" of a CR2 file, for example is a bit larger than the pixel dimensions of the image to be represented. That is because the demosaicing algorithm, in developing its best guess as to the color of any image pixel, must work from a cluster of sensel values typically centered on the target pixel location. Thus to develop the colors of the pixels that, for example law at the extremes of the image, the algorithm must consider sensor values lying "beyond the edge" of the image proper. And thus the raw file includes sensel values lying "beyond the edge" of the actual image.

What I had not known is that raw development engines, if properly instructed, will in fact develop an image whose pixel dimensions are the same as the dimensions of the sensel grid in the file. But how can the demosaicing engine go this? For the outermost pixels of this developed image, there are no sensel values beyond it in one direction to compete the "cluster" from which the algorithm normally works..

The answer is that the pixels developed beyond the normal limits of the image are "compromised", and are not as "reliable" in their color as the pixels developed over the scope of the image itself.

And IrfanView in fact tells the raw developing engine (it uses the famous DCRaw engine) to develop this oversized image.

And InfanView uses all that to display the content of the file.

And IrfanView, in presenting in its Information panel, states the dimensions of this "oversized" image as the dimensions of the image in the file. (And of course it is!) For my G16 image, for the CR2 file, that was 4072 × 3045 px; for teh DNG file, 4024 × 3031 px.

And if we have IranView save the developed image as a JPG file, it will actually have pixel dimensions larger than the pixel dimensions of the JPG file delivered by the camera. in fact, more generally, and not surprisingly, when IrfanView saves a resident image as a JPG file, its pixel dimensions are those of the image used for display. Thus, in the case where Irfan view takes a 1600 × 1200 px "Preview" image from the CR2 file, a save as JPG produces a JOG file with dimensions 1600 × 1200 px.

Does this mean that we can see, on-screen in IrfanView, or in a JPG image delivered by IrfanView, stuff that is beyond the margin of the camera-generated JPG image? Yes. (Only by a few pixels - 18 or 22 in the case of the CR2 file I considered, less for the DNG file.)

Next I considered how other raw file handling tools deal with this. First, Photoshop equipped with ACR.

For both the raw files (CR2 and DNG) relating to my G16 shot, the ACR window reported the image dimensions as 4000 × 3000 px. If I saved the "converted" file as a JPG file, its image dimensions were 4000 × 3000 px.

Next, Raw Therapee. It reported different image sizes for the two raw files. For the CR2 file, it reported 4064 × 4037 px; for the DNG file, 4016 × 3023 px.

In each case, if I had it save the developed image as a JPG file, that file had image dimensions matching those displayed for the loaded image.

Now this all raises the question, "What should IrfanView report as the size of the loaded image? My first thought was that, for my two raw test files, it should report 4000 × 3000 px, the "intended size" of the contained image, regardless of what size image IrfanView (based in part on the user settings) extracted to use to make the display.

But the clinker in so doing is that in fact InfraView, if asked to save a JPG version of the image, makes one with the pixel dimensions of the image used for display, not one of the "intended size" (4000 × 3000 px, for my example.

Irfan and I had a spirited discussion of this matter. The conclusion was that what IrfanView does is perhaps as "correct" as anything.

Thanks to Irfan for his fine work in developing IrfanView and for taking the time to discuss with me the matter I discuss above.

Best regards,

Doug
 

Doug Kerr

Well-known member
I don't know nearly enough about raw files to understand the significance of this, but it is interesting that, for both my example CR2 and DNG files, Raw Therapee and IrfanView report different "image dimensions". They differ by 8 px in each direction for both files (smaller for Raw Therapee).

Perhaps Raw Therapee feels that it wouild not be prudent to develop an image with the same pixel size as the dimensions of the full sensel grid of the raw data (as IrfanView will do).

ACR of course only develops a file of the pixel dimensions that the largest dimension JPG file ex camera would have.

The raw development tool in Corel PhotoPaint X7 reports the larger set of dimensions for a raw file, and develops an image of those dimensions. I presume the demosiaicing is compromised around the edges.

Best regards,

Doug
 
Top