🚨 rethumb will shutdown on September 4th, 2021 🚨 (Twitter)

<< More Tutorials

How to resize an image to cover any dimensions in Python 2 using rethumb?

To resize an image, with our "cover" operation, in Python 2 use the following code:

import urllib2

param_operation = "cover"
param_value = "150x200" # New WIDTHxHEIGHT in pixels.

image_url = "http://images.rethumb.com/image_coimbra_600x300.jpg"
image_filename = "resized-image.jpg"

response = urllib2.urlopen("http://api.rethumb.com/v1/{0}/{1}/{2}".format(param_operation, param_value, image_url))
fh = open(image_filename, "w")

Start using this example now

Use the following commands to get started:

$ git clone https://github.com/rethumb/rethumb-python2-examples.git
$ cd rethumb-python2-examples
$ python cover.js

More examples using Python 2