-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Hi, the README says:
This tool supports only raster graphics.
All the examples show using PNGs but I thought I'd try a JPG and it crashes the program:
hexsticker dp.jpg
INFO:hexsticker.create:Writing output to 'dp-sticker.jpg'
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/PIL/JpegImagePlugin.py", line 643, in _save
rawmode = RAWMODE[im.mode]
KeyError: 'RGBA'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/hexsticker/create.py", line 206, in create_hexsticker
img.save(output_file, output_file_type.upper())
File "/usr/lib/python3.10/site-packages/PIL/Image.py", line 2431, in save
save_handler(self, fp, filename)
File "/usr/lib/python3.10/site-packages/PIL/JpegImagePlugin.py", line 646, in _save
raise OSError(msg) from e
OSError: cannot write mode RGBA as JPEG
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/bin/hexsticker", line 33, in <module>
sys.exit(load_entry_point('hexsticker==1.2.0', 'console_scripts', 'hexsticker')())
File "/usr/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python3.10/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/usr/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3.10/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/usr/lib/python3.10/site-packages/hexsticker/cli.py", line 69, in hexsticker
create_hexsticker(**options)
File "/usr/lib/python3.10/site-packages/hexsticker/create.py", line 208, in create_hexsticker
raise exceptions.SaveError(f"Failed to save resulting image: {str(exc)}") from exc
hexsticker.exception.SaveError: Failed to save resulting image: cannot write mode RGBA as JPEG
Have I made a mistake, e.g. missed installing a library? Or does the program not support JPEG? I'd guess the latter because the stack trace mentions saving RGBA as JPEG, and I suppose the A in RGBA is because of the transparent background after the hexagon is cut out and JPEGs don't support transparency. Maybe it would be good to add a file type check at the beginning of the program to make sure the user provides an input filetype that will support transparency in the output?
Metadata
Metadata
Assignees
Labels
No labels