Home > python > jpegtran-cffi: fast JPEG transformations

jpegtran-cffi: fast JPEG transformations

I haven’t tried it yet but it seems perfect for creating thumbnails for instance for a collection of images.

jpegtran-cffi has a very intuitive interface. Examples:

from jpegtran import JPEGImage
img = JPEGImage('image.jpg')

# Dimensions
print img.width, img.height  # "640 480"

# Transforming the image
img.scale(320, 240).save('scaled.jpg')
img.crop(0, 0, 100, 100).save('cropped.jpg')

# Transformations can be chained
data = (img.scale(320, 240)

It looks nice, worth checking out.

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: