Anonymous user
Bitmap/PPM conversion through a pipe: Difference between revisions
Bitmap/PPM conversion through a pipe (view source)
Revision as of 22:40, 8 December 2018
, 5 years agoAdd Python example from Stack Overflow
(Add Python example from Stack Overflow) |
|||
Line 218:
(ppmWrite *Ppm '("convert" "-" "img.jpg"))</lang>
=={{header|Python}}==
<lang Python>
"""
Adapted from https://stackoverflow.com/questions/26937143/ppm-to-jpeg-jpg-conversion-for-python-3-4-1
Requires pillow-5.3.0 with Python 3.7.1 32-bit on Windows.
Sample ppm graphics files from http://www.cs.cornell.edu/courses/cs664/2003fa/images/
"""
from PIL import Image
im = Image.open("boxes_1.ppm")
im.save("boxes_1.jpg")
</lang>
Does not need to pipe through a conversion utility
because the Pillow module does the conversion.
=={{header|Racket}}==
|