Page 1 of 3

PNG compression

Posted: Thu Apr 08, 2021 6:44 am
by Balmung
The file size of my exported map is 52MB, which seems to be pretty little for DIN A0 at 300 dpi. Other projects I exported from Inkscape produced files over 500MB (also DIN A0, 300 dpi).

Since the compression slider is disabled for PNGs, I assumed that no compression was applied, but the file size makes me wonder :)

Re: PNG compression

Posted: Thu Apr 08, 2021 8:51 am
by SilverSurfer1221
I would say that file is not compressed at all. I just took a look several of my pieces of art, exported as PNG, in the same or similar sizes as DIN A0, and they are less than 40MB, non-compressed. That 500MB PNG out of Inkscape? That sounds like an issue, actually, as 500MB is really excessive for that size. BTW - The pieces Iooked at were exported from a variety of programs, including Photoshop, Affinity Photo, and Clip Studio Paint.

Re: PNG compression

Posted: Thu Apr 08, 2021 9:01 am
by Balmung
It could be an issue of Inkscape (v1.0.1) :\

But it's easy to reproduce, if you want to try it:
  1. Set document size to DIN A0.
  2. Set background colour to white.
  3. Export with this settings:
    • Export area: page
    • 300 dpi
    • RGBA_8
    • Z_NO_COMPRESSION
    • CAIRO_ANTIALIAS_BEST

Re: PNG compression

Posted: Thu Apr 08, 2021 9:13 am
by SilverSurfer1221
I did just that with Affinity Photo (raster-based, like Photoshop) and Affinity Designer (vector-based, like Inkscape). I get a PNG file that is under 40MB with a full-color image at DIN A0. With a blank, white page at DIN A0, I get a PNG file that is 434kb (that's kilobytes ... just so there's no misreading this as megabytes). 500MB is unreasonably large for a PNG file, especially at the size you're exporting to. Again, it sounds like an Inkscape issue. The file from OWM sounds like it's right where it needs to be when compared to PNG files exported, non-compressed, from other software.

Re: PNG compression

Posted: Thu Apr 08, 2021 9:18 am
by SilverSurfer1221
Remember, PNG (Portable Graphics Format) was created to be an uncompressed raster format for use on the internet. It's original intent was to replace the GIF. As a result, PNG, by its nature, it is meant to produce a reasonably small file for use on a website.

Re: PNG compression

Posted: Thu Apr 08, 2021 9:23 am
by Balmung
How do you set the compression level in Affinity Designer? I couldn't find it.

I would export as PDF to keep my vectors alive if I could ;)
(https://otherworldmapper.com/forum/view ... f=17&t=532)

Re: PNG compression

Posted: Thu Apr 08, 2021 9:30 am
by SilverSurfer1221
I don't believe you can (in Affinity Designer). PNG is not meant to be compressed. As a file format, it is meant to be uncompressed ... it's supposed to be a lossless file format. There are websites and pieces of software out there to "compress" PNG files, but this is not what the file format was meant to be. It's not JPG. If you want to compress (thus, losing data ... a lossy format), then use JPG.

Re: PNG compression

Posted: Thu Apr 08, 2021 9:46 am
by Balmung
Well, Inkscape and GIMP doesn't care about the history of PNG and asks the user for the compression level :)

Which I always set to the lowest level, because storage doesn't matter ;)

Re: PNG compression

Posted: Thu Apr 08, 2021 9:59 am
by SilverSurfer1221
GIMP and Inkscape may not care, but you're defeating the purpose of what a PNG is for by compressing it (or at least GIMP and Inkscape are). If you want compression, you use a lossy file format, like JPG. That's what it's there for. If you don't want to lose any data (image quality, etc.) then you use a lossless format like PNG. BMP, Tiff, etc., are also lossless, but are too big (file size in bytes) for most internet use. Thus, PNG was created.

Just because a program like GIMP or Inkscape offers compression for PNG does not mean they should. There is a reason that most graphics software (Photoshop, Clip Studio Paint, Affinity Photo and Designer, etc.) do not offer compression for PNG - because the intended purpose of PNG is not to be compressed. That's what JPG is for.

It's not about the HISTORY of the the file format, it's about the INTENDED PURPOSE of the file format.

Re: PNG compression

Posted: Thu Apr 08, 2021 10:07 am
by Balmung
You don't need to tell me that, I'm just an user and those software asks me which compression level it shall apply. There is nothing I can do about it ^^

The question is: Does the piece of code, which OWM uses to generate the PNG exports, also use a compression level and is it adjustable?