from PIL import Image, ImageDraw, ImageFont
im = Image.open('/var/www/examples/heroine.png')
im.save('out.jpg', quality=95)
PIL
- import lib:Pillow package modulesImage.open
- open given image with Pillow.save(
- saves image under given path (format is automatically picked based on file extension)quality
- sets JPG quality value95
- quality value to use (where100
is the best quality while lower values = worse quality)
group: compress