Skencil - Patches: patch #2843, Formats in sk2ppm.py
You are not allowed to post comments on this tracker with your current authentication level.
patch #2843: Formats in sk2ppm.py
Submitter: | Frank Koormann <coreman> | ||
Submitted: | Mon 22 Mar 2004 09:21:14 AM UTC | ||
Category: | for 0.6 series | Priority: | 5 - Normal |
Status: | None | Privacy: | Public |
Assigned to: | None | Open/Closed: | Open |
Sat 24 Apr 2004 07:57:46 PM UTC, comment #1: |
Bernhard Herzog <bh>![]() |
Mon 22 Mar 2004 09:21:14 AM UTC, original submission:
The patch enables sk2ppm to use all raster formats supported by Script.export_raster:
|
Frank Koormann <coreman> |
Attached Files
file #7172: sk2ppm.py_formats.patch added by coreman (3KiB - application/octet-stream - Patch sk2ppm.py )
Depends on the following items: None found
Items that depend on this one: None found
CC list is empty
There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.
Follow 2 latest changes.
Date | Changed by | Updated Field | Previous Value | => | Replaced by |
---|---|---|---|---|---|
2004-03-22 | coreman | Attached File | - | ![]() |
Added sk2ppm.py_formats.patch, #2971 |
Carbon-Copy | - | ![]() |
Added coreman |
There are several bugs in the patch
1. Omitting the filetype doesn't work:
Traceback (most recent call last):
File "./sk2ppm.py", line 127, in ?
result = main()
File "./sk2ppm.py", line 123, in main
export_raster(context, ppmfile, resolution, use_bbox, format = format,
UnboundLocalError: local variable 'format' referenced before assignment
2. The filelist in Script.export_raster is only meant for the tk file dialog. The patch uses the file name extension from that list as the format parameter to export_raster. That parameter is not the extension. It's the name PIL uses for the format which can be different. In the case of JPG for instance the extension is "jpg" whereas the PIL format name is "JPEG" (PIL matches the format name case insensitivley, though). This means -f jpg gives an error:
Traceback (most recent call last):
File "./sk2ppm.py", line 127, in ?
result = main()
File "./sk2ppm.py", line 124, in main
antialias = alpha)
File "./Script/export_raster.py", line 163, in export_raster
image.save(filename, format = format)
File "/usr/local/lib/python2.2/site-packages/PIL/Image.py", line 729, in save
SAVE[string.upper(format)](self, fp, filename)
KeyError: JPG