Different sizes of PNG

Ask for help and post your question on how to use XnView Classic.

Moderators: XnTriq, helmut, xnview

User avatar
Ty
Posts: 152
Joined: Thu Feb 23, 2006 3:18 am
Location: San Luis Obispo, California

Different sizes of PNG

Post by Ty »

This is not a problem with XnView or even a "how to" question. It's more a matter of trying to understand something about image file formats.

I have an 18MB TIFF image. When I save it as PNG using XnView (both classic and MP), I get a PNG file of 3.3MB.

When I save that same TIFF file using Photoshop Elements, I get a PNG file of 18MB.

I understand that the file save process can use different compression methods. What I don't understand is why or how two PNG files could differ so greatly in size and both still have all the information of the original TIFF.

And with all due respect to XnView and Pierre, it's hard to believe that XnView's compression algorithm is six times better than Adobe's.

Thanks for whatever light you can shed on this.
cday
XnThusiast
Posts: 3985
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Different sizes of PNG

Post by cday »

When you look at the file properties of each file, wherever that is displayed in XnView Classic, what do you see in terms of compression method?

And are all the other possibly relevant properties, such as pixel dimensions and colour depth, identical?

Perhaps you could post screenshots of the properties, or links to two example files?
User avatar
Ty
Posts: 152
Joined: Thu Feb 23, 2006 3:18 am
Location: San Luis Obispo, California

Re: Different sizes of PNG

Post by Ty »

I compared the properties, both "file" and "image," of the two files (one saved with XnView and 3.3MB, the other saved with Photoshop Elements and 18.0MB) and all the specs were identical.
User avatar
XnTriq
Moderator & Librarian
Posts: 6344
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Different sizes of PNG

Post by XnTriq »

Welcome back, Ty! Good to see you again :-D

What's the color depth/bit depth of the original TIFF?
Could you provide a sample?
User avatar
Ty
Posts: 152
Joined: Thu Feb 23, 2006 3:18 am
Location: San Luis Obispo, California

Re: Different sizes of PNG

Post by Ty »

Hey Triq--

You probably wouldn't say that if you could actually see me, but thanks for the thought. :D I'm glad to see you're still XnViewing.

The bit depth on the TIF file is 24 bpp.

I created a new and smaller TIF file (with Photoshop), then saved it as a PNG with both PS and XnView. Same results: XnView's version is 834KB, Photoshop's is 2.9MB. I don't know how to get the files to you, else I would do so.

Please don't spend much time on this. There are many things in the world I don't understand, adding one more to the list is not going to upset any apple carts. Thanks for your comments.
cday
XnThusiast
Posts: 3985
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Different sizes of PNG

Post by cday »

I've booted a spare laptop into Windows so that I can view XnView Classic, v2.50 rather than the current version though.

The file information panel I suggested checking can be accessed when the file is selected in the browser, using Edit > Properties (Alt + Enter).

You might take a look at that display for each file, or better post screenshots... :D

If you are using XnView regularly, though, it might be worth thinking about taking a look now at XnView MP.
User avatar
Ty
Posts: 152
Joined: Thu Feb 23, 2006 3:18 am
Location: San Luis Obispo, California

Re: Different sizes of PNG

Post by Ty »

Hi Cday--

Thanks for comments. I posted the answer to your question above. Properties for both files are identical.

Also, I don't understand your reference to XnView versions. I'm running the latest versions (Windows) of Classic and MP, get same results with both.
cday
XnThusiast
Posts: 3985
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Different sizes of PNG

Post by cday »

OK, but the suggestion in an edit to my last post to take a look at XnView MP, if you haven't done so recently might still be worth trying, there may be additional information shown in the information panel included in the viewer.

I am normally in Linux and using XnView MP, though, but example files would also be ideal.
User avatar
XnTriq
Moderator & Librarian
Posts: 6344
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Different sizes of PNG

Post by XnTriq »

Ty wrote: Sat Oct 28, 2023 1:14 pmYou probably wouldn't say that if you could actually see me, but thanks for the thought.
You should know me better by now! I had seen the KSBY interview and stand by my statement 8-)

Ty wrote: Sat Oct 28, 2023 1:14 pmI don't know how to get the files to you, else I would do so.
FileTransfer.io is free. No registration required.
User avatar
Ty
Posts: 152
Joined: Thu Feb 23, 2006 3:18 am
Location: San Luis Obispo, California

Re: Different sizes of PNG

Post by Ty »

Triq--

Thanks for link to transfer service. I've needed that for a long time.

Here are files: https://filetransfer.io/data-package/olsQteKb#link

Three files:

.tif = starting source 2.96MB
-ps.png = saved with Photoshop Elements 2.95 MB
-xn.png = saved with XnView .83MB

KSBY interview?!!! Where are you?
cday
XnThusiast
Posts: 3985
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Different sizes of PNG

Post by cday »

These are the file properties of the PS and XN files displayed in XnView MP:

PS-XN.png

All displayed properties do indeed look identical, except that the PS file has an additional tab displaying XMP metadata stored in the file... :idea:

One small qualification, the compression type ZIP is displayed, but not the compression level, not sure whether that can be determined.

Deleting the PS file XMP metadata reduces the file size to 847KiB, almost identical to the size of the XN file. :D

[Updated]
You do not have the required permissions to view the files attached to this post.
cday
XnThusiast
Posts: 3985
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Different sizes of PNG

Post by cday »

While the above seems to explain the difference file sizes of the two test images supplied, the difference in file size between the PS and XN images originally referenced is so much greater, at 18 MB and 3 MB, possibly it is not the whole story.

@Ty: As I see you have XnView MP installed, you could open each file in that software and compare the file properties in the viewer option Image > Properties... or the corresponding toolbar icon if enabled.
User avatar
XnTriq
Moderator & Librarian
Posts: 6344
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Different sizes of PNG

Post by XnTriq »

Thanks for the samples, Ty!

AsTiffTagViewertest22.tif:

Code: Select all

       SubFileType (1 Long): Zero
       ImageWidth (1 Short): 1173
      ImageLength (1 Short): 875
    BitsPerSample (3 Short): 8, 8, 8
      Compression (1 Short): Uncompressed
      Photometric (1 Short): RGB
             Make (6 ASCII): Epson
            Model (8 ASCII): ET-2760
      StripOffsets (1 Long): 25904
      Orientation (1 Short): TopLeft
  SamplesPerPixel (1 Short): 3
     RowsPerStrip (1 Short): 875
   StripByteCounts (1 Long): 3079125
   XResolution (1 Rational): 300
   YResolution (1 Rational): 300
     PlanarConfig (1 Short): Contig
   ResolutionUnit (1 Short): Inch
        Software (40 ASCII): Adobe Photoshop Elements 19.0 (Windows)
        DateTime (20 ASCII): 2023:10:28 06:01:59
           700 (14397 Byte): 60, 63, 120, 112, 97, 99, 107, 101, 116, 32,...
      Photoshop (7976 Byte): 56, 66, 73, 77, 4, 37, 0, 0, 0, 0, 0, 16, 0,...
             34665 (1 Long): 3105032
ICCProfile (3144 Undefined):
TweakPNGtest22ps.png:

Code: Select all

Chunk │  Length │ CRC      │ Attributes                │ Contents
──────┼─────────┼──────────┼───────────────────────────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
IHDR  │      13 │ 70693e6e │ critical                  │ PNG image header: 1173×875, 8 bits/sample, truecolor, noninterlaced
pHYs  │       9 │ 78a53f76 │ ancillary, safe to copy   │ pixel size = 11811×11811 pixels per meter (300.0×300.0 dpi)
iCCP  │    2637 │ 25d29f33 │ ancillary, unsafe to copy │ embedded ICC profile: [Photoshop ICC profile]
iTXt  │   17356 │ 6c1b0999 │ ancillary, safe to copy   │ text (international), key=“XML:com.adobe.xmp” (nonstandard): “<xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d">|<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 6.0-c003 116.a360872, 2021/08/02-09:55...”
cHRM  │      32 │ 97a999d4 │ ancillary, unsafe to copy │ chromaticities: WP(0.31269,0.32899),R(0.63999,0.33000),G(0.30000,0.60000),B(0.14999,0.05999)
IDAT  │ 3080476 │ 6c991786 │ critical                  │ PNG image data
IEND  │       0 │ ae426082 │ critical                  │ end-of-image marker
TweakPNGtest22xn.png:

Code: Select all

Chunk │ Length │ CRC      │ Attributes                │ Contents
──────┼────────┼──────────┼───────────────────────────┼────────────────────────────────────────────────────────────────────
IHDR  │     13 | 70693e6e │ critical                  │ PNG image header: 1173×875, 8 bits/sample, truecolor, noninterlaced
iCCP  │   2609 | 710186eb │ ancillary, unsafe to copy │ embedded ICC profile: [ICC profile]
pHYs  │      9 | 78a53f76 │ ancillary, safe to copy   │ pixel size = 11811×11811 pixels per meter (300.0×300.0 dpi)
IDAT  │   8192 | a2824ebd │ critical                  │ PNG image data
IDAT  │   8192 | 751c8054 │ critical                  │ PNG image data
IDAT  │   8192 | 868a4a2b │ critical                  │ PNG image data
IDAT  │   8192 | b6c3539f │ critical                  │ PNG image data
IDAT  │   8192 | dfd89160 │ critical                  │ PNG image data
IDAT  │   8192 | 60279028 │ critical                  │ PNG image data
IDAT  │   8192 | f3b75a5d │ critical                  │ PNG image data
IDAT  │   8192 | 690ea8d9 │ critical                  │ PNG image data
IDAT  │   8192 | 63a52b97 │ critical                  │ PNG image data
IDAT  │   8192 | 1e43121a │ critical                  │ PNG image data
IDAT  │   8192 | 6121316a │ critical                  │ PNG image data
IDAT  │   8192 | bae751f0 │ critical                  │ PNG image data
IDAT  │   8192 | f1dcd956 │ critical                  │ PNG image data
IDAT  │   8192 | e20b7644 │ critical                  │ PNG image data
IDAT  │   8192 | 02339f4b │ critical                  │ PNG image data
IDAT  │   8192 | e6f326fa │ critical                  │ PNG image data
IDAT  │   8192 | 968e766d │ critical                  │ PNG image data
IDAT  │   8192 | 7a8c1083 │ critical                  │ PNG image data
IDAT  │   8192 | 98780425 │ critical                  │ PNG image data
IDAT  │   8192 | c8ff4937 │ critical                  │ PNG image data
IDAT  │   8192 | 100a3cfb │ critical                  │ PNG image data
IDAT  │   8192 | 0d2c478c │ critical                  │ PNG image data
IDAT  │   8192 | 3326ea5e │ critical                  │ PNG image data
IDAT  │   8192 | 6656a2ed │ critical                  │ PNG image data
IDAT  │   8192 | 49733389 │ critical                  │ PNG image data
IDAT  │   8192 | 3ed7f8a0 │ critical                  │ PNG image data
IDAT  │   8192 | 366d187e │ critical                  │ PNG image data
IDAT  │   8192 | 6c521cde │ critical                  │ PNG image data
IDAT  │   8192 | 80516719 │ critical                  │ PNG image data
IDAT  │   8192 | df76112e │ critical                  │ PNG image data
IDAT  │   8192 | c275718d │ critical                  │ PNG image data
IDAT  │   8192 | b711b330 │ critical                  │ PNG image data
IDAT  │   8192 | b310d1cd │ critical                  │ PNG image data
IDAT  │   8192 | e3f9d30f │ critical                  │ PNG image data
IDAT  │   8192 | d1e99d55 │ critical                  │ PNG image data
IDAT  │   8192 | c317a1f4 │ critical                  │ PNG image data
IDAT  │   8192 | 9a65b06e │ critical                  │ PNG image data
IDAT  │   8192 | 4c0bdd01 │ critical                  │ PNG image data
IDAT  │   8192 | bad76f13 │ critical                  │ PNG image data
IDAT  │   8192 | f00bc6bc │ critical                  │ PNG image data
IDAT  │   8192 | dd07990b │ critical                  │ PNG image data
IDAT  │   8192 | d16353d9 │ critical                  │ PNG image data
IDAT  │   8192 | 6cbd5634 │ critical                  │ PNG image data
IDAT  │   8192 | 29d3607e │ critical                  │ PNG image data
IDAT  │   8192 | 358edccb │ critical                  │ PNG image data
IDAT  │   8192 | 6016887c │ critical                  │ PNG image data
IDAT  │   8192 | b92faca9 │ critical                  │ PNG image data
IDAT  │   8192 | 1b40b053 │ critical                  │ PNG image data
IDAT  │   8192 | 8abb5505 │ critical                  │ PNG image data
IDAT  │   8192 | 40749381 │ critical                  │ PNG image data
IDAT  │   8192 | fce1e259 │ critical                  │ PNG image data
IDAT  │   8192 | b39ec508 │ critical                  │ PNG image data
IDAT  │   8192 | 95db91d1 │ critical                  │ PNG image data
IDAT  │   8192 | 311392a8 │ critical                  │ PNG image data
IDAT  │   8192 | 43fcb928 │ critical                  │ PNG image data
IDAT  │   8192 | dd86a1a9 │ critical                  │ PNG image data
IDAT  │   8192 | c1f5e365 │ critical                  │ PNG image data
IDAT  │   8192 | 66c57492 │ critical                  │ PNG image data
IDAT  │   8192 | 033d3d6c │ critical                  │ PNG image data
IDAT  │   8192 | 0aee96c2 │ critical                  │ PNG image data
IDAT  │   8192 | bcc6031a │ critical                  │ PNG image data
IDAT  │   8192 | 1dd285db │ critical                  │ PNG image data
IDAT  │   8192 | 477ff40e │ critical                  │ PNG image data
IDAT  │   8192 | 42dc319c │ critical                  │ PNG image data
IDAT  │   8192 | 22631302 │ critical                  │ PNG image data
IDAT  │   8192 | f85200cf │ critical                  │ PNG image data
IDAT  │   8192 | b3c3d89a │ critical                  │ PNG image data
IDAT  │   8192 | a84b5edb │ critical                  │ PNG image data
IDAT  │   8192 | 1d31b12b │ critical                  │ PNG image data
IDAT  │   8192 | 067f9449 │ critical                  │ PNG image data
IDAT  │   8192 | 5a44ded1 │ critical                  │ PNG image data
IDAT  │   8192 | 82bc8d79 │ critical                  │ PNG image data
IDAT  │   8192 | 723ff260 │ critical                  │ PNG image data
IDAT  │   8192 | 02f6969f │ critical                  │ PNG image data
IDAT  │   8192 | 6f2df969 │ critical                  │ PNG image data
IDAT  │   8192 | fc3d35b1 │ critical                  │ PNG image data
IDAT  │   8192 | 5e4406c7 │ critical                  │ PNG image data
IDAT  │   8192 | ebc5544c │ critical                  │ PNG image data
IDAT  │   8192 | 0eae3303 │ critical                  │ PNG image data
IDAT  │   8192 | 976270c7 │ critical                  │ PNG image data
IDAT  │   8192 | 09554197 │ critical                  │ PNG image data
IDAT  │   8192 | c75a07c0 │ critical                  │ PNG image data
IDAT  │   8192 | adceb58e │ critical                  │ PNG image data
IDAT  │   8192 | fbb4ffb8 │ critical                  │ PNG image data
IDAT  │   8192 | 101bcd5a │ critical                  │ PNG image data
IDAT  │   8192 | 3a6488bc │ critical                  │ PNG image data
IDAT  │   8192 | 01da9364 │ critical                  │ PNG image data
IDAT  │   8192 | 523b3b02 │ critical                  │ PNG image data
IDAT  │   8192 | c9b87641 │ critical                  │ PNG image data
IDAT  │   8192 | 1c10f951 │ critical                  │ PNG image data
IDAT  │   8192 | 442da748 │ critical                  │ PNG image data
IDAT  │   8192 | aa60d9ce │ critical                  │ PNG image data
IDAT  │   8192 | 0b123d2a │ critical                  │ PNG image data
IDAT  │   8192 | 6061a264 │ critical                  │ PNG image data
IDAT  │   8192 | 02fc7066 │ critical                  │ PNG image data
IDAT  │   8192 | 81beb03c │ critical                  │ PNG image data
IDAT  │   8192 | 073d5e90 │ critical                  │ PNG image data
IDAT  │   8192 | 8cdbafae │ critical                  │ PNG image data
IDAT  │   8192 | 7ac2d483 │ critical                  │ PNG image data
IDAT  │   8192 | 15d6a75d │ critical                  │ PNG image data
IDAT  │   8192 | 73159a2c │ critical                  │ PNG image data
IDAT  │   8192 | 877e6675 │ critical                  │ PNG image data
IDAT  │   8192 | a03158f6 │ critical                  │ PNG image data
IDAT  │   6717 | c998cd7e │ critical                  │ PNG image data
IEND  │      0 | ae426082 │ critical                  │ end-of-image marker
I used PngOptimizer to combine the IDAT chunks and to remove all ancillary chunks from test22ps.png as well as test22xn.png:

Code: Select all

Optimizing test22ps.png (OK) 3100615 bytes -> 845889 bytes (27% of the original size)
Optimizing test22xn.png (OK)  854428 bytes -> 845889 bytes (99% of the original size)
According to Compare It!, the optimized versions of test22ps.png and test22xn.png are identical.
User avatar
XnTriq
Moderator & Librarian
Posts: 6344
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: Different sizes of PNG

Post by XnTriq »

cday wrote: Sat Oct 28, 2023 7:05 pmDeleting the PS file XMP metadata reduces the file size to 847KiB, almost identical to the size of the XN file.
TweakPNG and PNG file chunk inspector agree that the iTXt chunk in test22ps.png (which contains the XMP metadata) is only 17'356 bytes in size.

It seems to me that test22ps.png was saved with a compression level of 0 (no compression).
cday
XnThusiast
Posts: 3985
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Different sizes of PNG

Post by cday »

XnTriq wrote: Sat Oct 28, 2023 8:15 pm It seems to me that test22ps.png was saved with a compression level of 0 (no compression).
That would certainly make sense of the difference in file sizes of the original PS and XN-saved files referred to.

A pity that PNG compression level isn't displayed in the XnView MP file properties display, do you think that the value could be determined and possibly added?