FS#72461 - [Inkscape] cannot export to JPG

Attached to Project: Arch Linux
Opened by zeroconf (zeroconf) - Sunday, 17 October 2021, 23:17 GMT
Last edited by Toolybird (Toolybird) - Thursday, 14 September 2023, 02:46 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Lukas Fleischer (lfleischer)
Christian Hesse (eworm)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 2
Private No

Details

Description:
When trying to export into JPG-format, it will not succeed and bunch of error messages comes into pop-up window.

Additional info:
* package version(s): Inkscape 1.1.1 (3bf5ae0d25, 2021-09-20) (https://archlinux.org/packages/extra/x86_64/inkscape/)
* config and/or log files etc.: no extra config, just default one
* link to upstream bug report, if any: no one

Steps to reproduce:
1. import any image into Inkscape
2. select that image
3. initiate export via SHIFT+CTRL+E
4. use Export as choice or just write *.jpg as file extension to use automatic file type selection by extension

Although there is mentioned, that this is PNG-export, using appropriate file extension, this should be able to export also into other formats.

Without python-lxml (https://archlinux.org/packages/extra/x86_64/python-lxml/) package installed, there are error messages:
Traceback (most recent call last):
File "/usr/share/inkscape/extensions/raster_output_jpg.py", line 6, in <module>
import inkex
File "/usr/share/inkscape/extensions/inkex/__init__.py", line 17, in <module>
from .extensions import *
File "/usr/share/inkscape/extensions/inkex/extensions.py", line 33, in <module>
from .elements import load_svg, BaseElement, ShapeElement, Group, Layer, Grid, \
File "/usr/share/inkscape/extensions/inkex/elements/__init__.py", line 9, in <module>
from ._base import SVG_PARSER, load_svg, ShapeElement, BaseElement
File "/usr/share/inkscape/extensions/inkex/elements/_base.py", line 31, in <module>
from lxml import etree
ModuleNotFoundError: No module named 'lxml'

When to install mentioned python-lxml package, exporting to JPG-format still not possible, even if to use "Export as" choice, choose JPG. Export dialog goes smoothly (without error messages above) but no *.jpg image appears to the determined location.

I propose two steps:
1. python-lxml package seems to be missing dependency
2. still there is JPG-export broken, even that extension is installed - this also needs attention
This task depends upon

Closed by  Toolybird (Toolybird)
Thursday, 14 September 2023, 02:46 GMT
Reason for closing:  Fixed
Additional comments about closing:  Works fine these days.
Comment by zeroconf (zeroconf) - Sunday, 17 October 2021, 23:20 GMT
Similarly there are error messages, when to try to export into TIFF:

Traceback (most recent call last):
File "/usr/share/inkscape/extensions/raster_output_tiff.py", line 22, in <module>
TiffOutput().run()
File "/usr/share/inkscape/extensions/inkex/base.py", line 131, in run
self.save_raw(self.effect())
File "/usr/share/inkscape/extensions/inkex/base.py", line 156, in save_raw
self.save(self.options.output)
File "/usr/share/inkscape/extensions/raster_output_tiff.py", line 15, in save
self.img.convert('RGB').save(stream,
File "/usr/lib/python3.9/site-packages/PIL/Image.py", line 2240, in save
save_handler(self, fp, filename)
File "/usr/lib/python3.9/site-packages/PIL/TiffImagePlugin.py", line 1756, in _save
offset = ifd.save(fp)
File "/usr/lib/python3.9/site-packages/PIL/TiffImagePlugin.py", line 900, in save
if fp.tell() == 0: # skip TIFF header on subsequent pages
OSError: [Errno 29] Illegal seek

I guess the task title could be changed and include also TIFF-format. I was just not aware until tested TIFF also. I just needed JPG initially and didn't suspect, that also TIFF has similar issue...
Comment by zeroconf (zeroconf) - Sunday, 17 October 2021, 23:22 GMT
... only *.webp export worked in addition of *.png.
Comment by Doug Newgard (Scimmia) - Sunday, 17 October 2021, 23:29 GMT
Yeah, this is what optional deps are for.
Comment by zeroconf (zeroconf) - Monday, 18 October 2021, 08:24 GMT
Two things:
* packages providing core functionality, should not be optional dependencies
* even installing that optional dependency, still functionality does not work <---- this is main issue

It seems, that some more optional dependencies should be installed to get that exporting (JPG, TIFF) to work, but cannot guess it, which packages - dependencies should be installed. Does not come out from error messages.
Comment by Nathan Lee (nathanal) - Wednesday, 20 October 2021, 16:34 GMT
Re: jpg export, issue is a bug in pillow https://gitlab.com/inkscape/extensions/-/issues/416 (https://gitlab.com/inkscape/inkscape/-/issues/2860 for tracking Windows) https://github.com/python-pillow/Pillow/issues/5657, PR: https://github.com/python-pillow/Pillow/pull/5665

For the tiff issue, strange, seems to be a problem with saving to stdout which is older. I wonder if it was working before. I opened an issue in https://gitlab.com/inkscape/extensions/-/issues/422 for inkscape just now (though maybe you might consider it covered by https://github.com/python-pillow/Pillow/issues/5657 if it is fixable there)

Loading...