Skip to main content

A simple tool to resize and crop an image

Project description

A simple tool to resize and crop an image

` rescale(image, size, mode=None) `

  • image: a PIL image object

  • size: a 2-tuple (width, height); at least one must be specified

  • mode: CROP_TL or CROP_BR

If no height or no width is specified, the mode won’t be taken into account, and the image will just be resized. If both width and height are provided, and the mode is set top CROP_TL or CROP_BR, the image will be cropped to the given size using the given mode. Note that the crop is made after the image as been resized (well not exactly, but the result is the same) to preserve as much as possible the content of the image. The resize is made so that the original ratio is preserved. The mode CROP_TL will keep the top left or the image, while CROP_BR will keep the bottom right of it.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rescale-0.2.zip (1.5 kB view details)

Uploaded Source

File details

Details for the file rescale-0.2.zip.

File metadata

  • Download URL: rescale-0.2.zip
  • Upload date:
  • Size: 1.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for rescale-0.2.zip
Algorithm Hash digest
SHA256 4ddd2d5215336d51e0ef019666ad4e267abc2a735bda86632313c7a9adecf892
MD5 a9958dc545bbce9483b9ae0187de85d7
BLAKE2b-256 2c3c8c1787ffd1bc8c333b45d006687e61eb200783feab021f510731f0260c3c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page