Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Shells Virtual Desktop
BMail.ag - Secure Email Service
Server.net
CPLicense.net
VPS Server
Buy VPN
Vultr
VMs for AI
HostDare
HostDare
ReliableSite White-Label Dedicated Hosting for Resellers
25% Recurring Discount on NVMe VPS
InterServer VPS
BMail.ag - Secure Email Service
Best VPN
High-Performance Bare Metal Server Solutions
Karvl.com
Server Mania Cloud Hosting
DataWagon Hosting
AlphaVPS Hosting
Evoxt.com
Clouvider
VPS Hosting with NVMe
Residential IPs in the US & 4G Mobile Proxies in EU & US with Unlimited Bandwidth
ReliableSite White-Label Dedicated Hosting for Resellers
Rabisu - Hosting Solutions
Shells Virtual Desktop
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Fixing Images Uploaded in Python Webapps

simdiasimdia Member
edited November 2016 in Tutorials

This a Python function method to “fix” images uploaded by webapp users. By fix, we mean,

Correct the image orientation (a somewhat nasty issue concerning JPEGs taken by cell phone cameras)
Strip the image of everything but its basic data (EXIF tags, gif animations, etc.)
Optionally restrict the width and/or height of the image, which is proportionally downsized to fit the tighter constraint using a high-quality downsampling algorithm

Usage documentation and an example are provided. You’ll need to install Pillow (python image library). Be sure to first install the external libraries to support additional image formats, etc. (don’t worry if they don’t all install successfully). See the Pillow Installation Instructions.

This code is free to use for any purpose.

Code: http://pastebin.com/yqGbU966

Sign In or Register to comment.