PNG compression
Moderator: Kanchou
Re: PNG compression
Maybe I'm a little bit lost in translation, but ... is the Linux version of OWM now better for exports or not?
Re: PNG compression
Assuming you're talking about file sizes/compression...
I just used OWM 1.0.4 to open the same existing map file in both Linux and Windows, then exported from each with the default PNG export settings. The Windows export is approximately 10% larger (6 528 930 bytes Linux, 7 251 973 bytes Windows). With a quick visual comparison, it appears that alpha-blended objects are slightly darker/less transparent on the Linux version. Bitmapped features are significantly clearer on the Windows version, while their lines are slightly blurred on the Linux version, which is probably why the Linux version is smaller. Based on this, I'd say Windows for better quality, Linux for smaller file sizes, although they really are pretty much the same overall.
But, of course, YMMV depending on the specific PNG library and library version you have installed.
I just used OWM 1.0.4 to open the same existing map file in both Linux and Windows, then exported from each with the default PNG export settings. The Windows export is approximately 10% larger (6 528 930 bytes Linux, 7 251 973 bytes Windows). With a quick visual comparison, it appears that alpha-blended objects are slightly darker/less transparent on the Linux version. Bitmapped features are significantly clearer on the Windows version, while their lines are slightly blurred on the Linux version, which is probably why the Linux version is smaller. Based on this, I'd say Windows for better quality, Linux for smaller file sizes, although they really are pretty much the same overall.
But, of course, YMMV depending on the specific PNG library and library version you have installed.
Re: PNG compression
Final raster is done via Cairo in Linux so the alpha blending is a tiny little bit different. The creation of the png is different as well but that's something we could change down the road by adding the ability to change the (lossless) compression mode.
Though I would say nowadays most people aren't as concerned with image size
- Alejandro
Though I would say nowadays most people aren't as concerned with image size
- Alejandro
Alejandro S. Canosa
Three Minds Software
Three Minds Software
Re: PNG compression
As long as a map cannot be exported as a PDF, even 1TB for a DIN-A0 map would be okay, if it means I got absolute zero compression or at least the lowest possible
Re: PNG compression
Not sure why you actively want larger files. Are you post-processing with tools that don't understand PNG format?
Image quality is not an issue here. PNG is a lossless compression algorithm, just like a ZIP archive. If you PNG compress an image and then re-render it from the compressed PNG file, the result will (barring bugs in the PNG library) be bit-for-bit identical to the original.
Proof:
I opened GIMP, created a new 1920x1080 image, and ran a "lava" render to fill it, then exported an uncompressed copy as A-Original.raw and a PNG-compressed copy as B-Compressed.png. After doing the exports, I exited GIMP, started a fresh GIMP session, loaded B-Compressed.png, and exported a third copy of the image as C-Reconstructed.raw.
Finally, I generated MD5 hashes for the two .raw files and ran a binary diff of the files:
Image quality is not an issue here. PNG is a lossless compression algorithm, just like a ZIP archive. If you PNG compress an image and then re-render it from the compressed PNG file, the result will (barring bugs in the PNG library) be bit-for-bit identical to the original.
Proof:
I opened GIMP, created a new 1920x1080 image, and ran a "lava" render to fill it, then exported an uncompressed copy as A-Original.raw and a PNG-compressed copy as B-Compressed.png. After doing the exports, I exited GIMP, started a fresh GIMP session, loaded B-Compressed.png, and exported a third copy of the image as C-Reconstructed.raw.
Note that the file size of 8294400 on the .raw files is equal to 1920*1080*4, providing further confirmation that they are uncompressed.~/Documents$ ls -l A-Original.raw B-Compressed.png C-Reconstructed.raw
-rw-r--r-- 1 me me 8294400 Jun 30 13:23 A-Original.raw
-rw-r--r-- 1 me me 2268371 Jun 30 13:23 B-Compressed.png
-rw-r--r-- 1 me me 8294400 Jun 30 13:24 C-Reconstructed.raw
Finally, I generated MD5 hashes for the two .raw files and ran a binary diff of the files:
The original and reconstructed raw images are 100% identical. PNG compression does not alter the content of the image in any way.~/Documents$ md5sum A-Original.raw C-Reconstructed.raw
dd66b8b08ff993812288875a5c083231 A-Original.raw
dd66b8b08ff993812288875a5c083231 C-Reconstructed.raw
~/Documents$ diff -b A-Original.raw C-Reconstructed.raw
~/Documents$
Re: PNG compression
I don't want larger files - I just don't care if they are large ;)
I attached an Inkscape-SVG with some lines to demonstate my thoughts.
Open it with Inkscape and export it with this settings:
- 300 dpi
- Z_NO_COMPRESSION
- CAIRO_ANTIALIAS_BEST
The file size is ~545MB with only some black lines.
At compression level 1 it shrinks to ~4MB.
When I export my OWM map, with a lot more going on, the exported PNG is ~60MB in size.
So my guess is, that some compression is happening. Maybe it's something with Windows 10 or the Windows version of Inkscape or the Windows version of OWM - I really don't know. That's why I asked the developers and got some answers, like:
I attached an Inkscape-SVG with some lines to demonstate my thoughts.
Open it with Inkscape and export it with this settings:
- 300 dpi
- Z_NO_COMPRESSION
- CAIRO_ANTIALIAS_BEST
The file size is ~545MB with only some black lines.
At compression level 1 it shrinks to ~4MB.
When I export my OWM map, with a lot more going on, the exported PNG is ~60MB in size.
So my guess is, that some compression is happening. Maybe it's something with Windows 10 or the Windows version of Inkscape or the Windows version of OWM - I really don't know. That's why I asked the developers and got some answers, like:
and
So it seems, that the Windows version of Inkscape is using Cairo for PNG exports, just like OWM - but the Windows version of OWM uses a different library. Maybe it's just that and the only thing I have to do is using Linux to export my map when the work is done.
- Attachments
-
- lines.zip
- (21.38 KiB) Downloaded 466 times
Re: PNG compression
Yesterday I saw this video https://www.youtube.com/watch?v=EFUYNoFRHQI and understand now how PNG works in general :)
So the compression levels and file sizes that irritates me and let me started this thread, are just a trade-off of how much processing time is used/required to de/encode an image. Although some things still irritates me, I accept them.
So the compression levels and file sizes that irritates me and let me started this thread, are just a trade-off of how much processing time is used/required to de/encode an image. Although some things still irritates me, I accept them.