Open Source Python API for Images
On-demand crop, re-sizing and flipping of images via Free Python API
Thumbor is an open source Python API to crop, re-size and flip images. You can access the feature of the API, thumbor offer an endpoint to retrieve image and image metadata. Using the API, you can remove the space around the images using the trim functionality, you can add manual cropping functionality is your application using the manual crop feature or you can just fit in the image exactly the size specified.
Furthermore, using the API you can use filters, extract metadata, specify the size of the output image, align the image horizontally and vertically using the API endpoints.
Getting Started with Thumbor
The recommended way to install thumbor is via Pip. Please use the following command to install thumbor.
Install thumbor via Pip
pip install thumbor
Manual Cropping in Images via Free Python API
Using Thumbor API you can the functionality of cropping images manually in your own applications. In order to perform manual cropping, you need to pass two points as arguments separated by a colon. where the first point is the left-top point of the cropping rectangle and the second point is the right-bottom point. This crop is performed before the rest of the operations, so it can be used as a preparation step before resizing and smart-cropping
Smart Cropping via Python API
$thumbor
->url($url)
->smartCrop(true)
->resize(150,400);
Horizontal and Vertical Image Alignment - Python
The Open Source image library thumbor allows aligning images horizontally and vertically. The horizontally align image controls where the crop of the image will occur. You can use three parameters for the horizontal align feature. Left only the left side, the center will trim equally from both sides, and the right will only trim from the right. Similarly, while using verticle alignment, the top only trims the bottom, the center will trim from both top and bottom, and the bottom align will trim the image from the top.
Add Filters in Images via Free Python API
Thumbor allows python developers to add filters in images programmatically. The API runs the filters in a pipeline and each filter is applied to the image in a specified order. The API provides a wide range of filters including, AutoJPG, Background Color, Blur, Brightness, Contrast, Convolution, Equalize, Extract focal points, Filling, Focal, Format, greyscale, Maxbytes, No upscale, Noise, Proportion, Quality, Red eye, RGB, Rotate, Round Corners, Sharpen, Stretch, Strip EXIF, Strip ICC, and watermark.
Apply Stretch Filters via Python
from preggy import expect
from tests.base import FilterTestCase
class StretchFilterTestCase(FilterTestCase):
def test_stretch_filter(self):
self.get_filtered('source.jpg', 'thumbor.filters.stretch', 'stretch()')
expect(self.context.request.stretch).to_be_true()