Python images converter (crop, resize, etc) with upload and caching
901
Images converting and storing service. Allow to crop, resize, rotate images on-fly.
Has modular architecture with different storage and caches available.
Just use this image in your docker-compose:
version: '3'
services:
web:
image: hypnocapybara/images-server
volumes:
- ./uploads:/app/uploads
ports:
- "5000:80"
And it goes to 5000 port
Has following operations:
POST /upload with file parameter. Will save
provided file in chosen storage and on success return:
{
"hash": "<hash>",
"status": "success"
}
GET /image/<hash> will return saved image.
Also possible to perform operations pipeline:
/image/<hash>/resize/x200/crop/e200x200
Crop: GET /image/<hash>/crop/<gravity><width>x<height>, ex: c200x200
Possible gravity values:
Resize: GET /image/<hash>/resize/<geometry> ex: 200x
Geometry examples:
200x200 - specified sizex100 - height = 100px, width calculated automatically300x200> if larger than 300x200, fit within box, preserving aspect ratioOther examples at ImageMagic documentation: https://www.imagemagick.org/script/command-line-processing.php#geometry
Combined: GET /image/<hash>/resize/400x400/crop/n100x100
External images: GET /external?url=<external_image_url>&operations=<operations>
Possible <operations> are listed above
<external_image_url> must contain valid external image
Default cache will be used to store the processed image.
If you want to update the image (for example, it was
changed, but URL is just the same), you may add
reset_cache=1 GET param to the URL, ex:
GET /external?url=<external_image_url>&operations=<operations>&reset_cache=1
But pay attention, that with this param, the image will be always downloaded, that may slow down the request.
Delete image: DELETE /image/<hash>
response with code 200:
{
"status": "success"
}
or with code = 404, if image is not exists:
{
"status": "error",
"message": "file not found"
}
TODO-list:
Optional:
Content type
Image
Digest
Size
352.4 MB
Last updated
almost 7 years ago
docker pull hypnocapybara/images-server