Bitmap/PPM conversion through a pipe: Difference between revisions
Content added Content deleted
(Add Python example from Stack Overflow) |
|||
Line 218: | Line 218: | ||
(ppmWrite *Ppm '("convert" "-" "img.jpg"))</lang> |
(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}}== |
=={{header|Racket}}== |