mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 09:26:16 +03:00
convert eps using pnmraw instead of ppmraw
This lets Ghostscript choose the best device to use (pbmraw, pgmraw, ppmraw) based on the image data.
This commit is contained in:
parent
283b41afa0
commit
3ccecd91ce
|
@ -178,7 +178,7 @@ def test_load_long_binary_data(prefix: bytes) -> None:
|
||||||
data = io.BytesIO(prefix + b"\n".join(simple_eps_file_with_long_binary_data))
|
data = io.BytesIO(prefix + b"\n".join(simple_eps_file_with_long_binary_data))
|
||||||
with Image.open(data) as img:
|
with Image.open(data) as img:
|
||||||
img.load()
|
img.load()
|
||||||
assert img.mode == "RGB"
|
assert img.mode == "1"
|
||||||
assert img.size == (100, 100)
|
assert img.size == (100, 100)
|
||||||
assert img.format == "EPS"
|
assert img.format == "EPS"
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,13 @@ def Ghostscript(
|
||||||
lengthfile -= len(s)
|
lengthfile -= len(s)
|
||||||
f.write(s)
|
f.write(s)
|
||||||
|
|
||||||
device = "pngalpha" if transparency else "ppmraw"
|
if transparency:
|
||||||
|
# "RGBA"
|
||||||
|
device = "pngalpha"
|
||||||
|
else:
|
||||||
|
# "pnmraw" automatically chooses between
|
||||||
|
# PBM ("1"), PGM ("L"), and PPM ("RGB").
|
||||||
|
device = "pnmraw"
|
||||||
|
|
||||||
# Build Ghostscript command
|
# Build Ghostscript command
|
||||||
command = [
|
command = [
|
||||||
|
|
Loading…
Reference in New Issue
Block a user