0

Here's the thing: I moved full time to Linux a few weeks ago and was editing a spreadsheet that I use regularly and suddenly realised that when I take a screenshot of a portion of it the resulting image now uses 2.5x the space of the Windows equivalent for the same screen area... why?

Steps

  • Windows 7: open spreadsheet in LibreOffice, take a whole screen screnshot with standard keyboard shortcut, paste in MS Paint, crop desired area, save as PNG
  • Ubuntu Linux 16.10: open spreadsheet in LibreOffice, take screenshot of desired area with the built in tool in Ubuntu, save as PNG

I event re-saved the Linux one with GIMP using maximum compression but the size of the screenshot image in Linux is about 106 KB while the one in Windows was about 42 KB for basically the same image size (10 pixel wider for same height of 360 pixels). The desktop size was 1920x1080 in Windows and is 1680x1050 in Linux but that should not matter as the image size is the same... GIMP reports the same number of pixels for both (about 305k), the same memory used when loaded (3.1 MB) and the same number of layers (1) - the only thing that differs is the dpi which was 96 in Windows and is 72 in Linux but again that should not matter given the the other numbers are the same.

Any explanation as to why? Is MS Paint maybe using a lossy PNG compression ??

  • There is no lossy PNG compression. What do the other elements on the picture look like? Are there gradients or transparent elements? Did you check for meta data information? – Seth Jan 27 '17 at 10:08
  • it's a screenshot so there aren't any sort of additional layers or elements to it and metadata is practically non-existent – Paolo Jan 27 '17 at 10:24
  • A lossless compressed gradient takes up more space than a singular color picture. As such the composition of the image does have an impact and that's what I was getting at. In addition almost every picture supports metadata. I don't know the tool so it was just a guess. – Seth Jan 27 '17 at 10:52
  • It would help to upload examples of the two files to somewhere, so we can actually look at the files and see how they differ. Without the files, all we can do is guess. – dirkt Jan 27 '17 at 16:57
0

There is no such thing as a lossy PNG compression.

But there certainly is something as a superior PNG compression. i.e. not every app that supports PNG compression can do as good a job as the other app.

It is for that reason that I use an app called PNGGauntlet in Windows to optimize the size of my PNG files. PNGGauntlet itself uses PNGOut, OptiPNG and DeflOpt and chooses the best of their outputs. In doing so, unnecessary transparency is discarded, color depth is reduced to the lowest possible and a better compression algorithm is used.

I believe you can compile a copy of OptiPNG for Linux.

  • a difference of 2.5 times doesn't sound like superior compression to me but instead like something's not right... – Paolo Jan 27 '17 at 10:26
  • 2.5x is nothing! PNGGauntlet sometimes gives me 9.8x difference. It reduces files at hundreds of kilobytes size to a few bytes! – user477799 Jan 27 '17 at 10:34
  • I have a solution for your suspicion. Toss me a screenshot and I'll run it through PNGGauntlet. That should give you a definite answer. – user477799 Jan 27 '17 at 10:38
  • I loaded both PNG images in gThumb and when I rotate them 90° there is a noticeable change in size: the Linux one goes from 110 KB to 80 KB while the Windows one goes from 60 KB to 50 KB (but never to the original 40 KB) so there might be some compression at play here but still sound strange! – Paolo Jan 27 '17 at 10:55
  • Not to me. PNGGauntlet has saved me gigabytes, I tell you. – user477799 Jan 27 '17 at 11:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.