Skip to content

Default options in optipng export fails

Steps to reproduce:

  • Install optipng. On Windows, download (optipng.sourceforge.net/) and place the downloaded exe in the bin folder that inkscape.exe is in, in Linux install via package manager
  • Open Inkscape
  • Open the Export PNG dialog
  • Export As
  • Change file type to Optimized PNG
  • Save

What happened?

  • Default option is minimal effort, (optimization level 0) and interlace enabled
Traceback (most recent call last):
  File "raster_output_png.py", line 49, in <module>
    PngOutput().run()
  File "/home/nal/all/1.1.x/build/out/share/inkscape/extensions/inkex/base.py", line 131, in run
    self.save_raw(self.effect())
  File "/home/nal/all/1.1.x/build/out/share/inkscape/extensions/inkex/base.py", line 156, in save_raw
    self.save(self.options.output)
  File "raster_output_png.py", line 37, in save
    call('optipng',
  File "/home/nal/all/1.1.x/build/out/share/inkscape/extensions/inkex/command.py", line 188, in call
    stdout = _call(program, *args, **kwargs)
  File "/home/nal/all/1.1.x/build/out/share/inkscape/extensions/inkex/command.py", line 172, in _call
    raise ProgramRunError(f"Return Code: {process.returncode}: {stderr}\n{stdout}\nargs: {args}")
inkex.command.ProgramRunError: Return Code: 1: b"** Processing: /tmp/inktmpw9np40k0/input.png\n794x1123 pixels, 4x8 bits/pixel, RGB+alpha\nIDAT recoding is necessary, but is disabled by the user.\nError: Can't continue\n\n** Status report\n1 file(s) have been processed.\n1 error(s) have been encountered.\n"
b''
args: ['/usr/bin/optipng', '-clobber', '-o=0', '-i=1', '-nb', '-nc', '-np', '/tmp/inktmpw9np40k0/input.png']

What should have happened?

  • More friendly warning message for this case
  • Maybe change the default values if possible?

Version info

  • Inkscape 1.1 Windows 7
  • Inkscape 1.1 (f559db2bc1, 2021-07-04) Linux Mint 20
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information