Project

General

Profile

Actions

Image processing

Current branch: feature_api_image

Related tickets: #1280, #1426, #1492

image resizing

Currently, supported file formats: '.jpeg', '.jpg', '.png', '.tiff', '.tif', '.ico', '.svg', '.bmp', '.gif'

Thumbnails for OpenAtlas will be stored in /processed_images/resized/<size> folder with the same name as the original file but as jpeg. (e.g. 12345.jpg will get 12345.jpeg, 51242.pdf will get 51242.jpeg)

Default resize values:
  • overview = '400'
  • thumbnail = '200'
  • table = '100'
  • icon = '30'

The size of processed images will declare the px length of the longer side of a file.

Example: 6000x4000px JPG file with 8,23 mb will result in a 400x200px jpg file with 114kb uncompressed, if size is set to 400. Compression is set to 75%.

If the uploaded file is a 'gif' then the first frame, page, layer etc. will be used as thumbnail.

Creation

The creation of resized images will be triggered on upload if IMAGE_PROCESSING = True. Old files will be resized, if the file is directly called or through the processes of profile image display. So IMAGE_PROCESSING can also be activated within an ongoing project, and the files get resized if they are called.

Preview for file table

The user can activate the table preview on his profile settings. The preview has the table size which is 100px per default. The function itself is fast, but the browser need a lot of time to load the images.

API implementation

We also provide a dynamic resize of images. The endpoint /api/display/ takes has a new parameter named image_size, which will take a number. The number will be the pixel length of the longer side of the image, e.g. /api/display/130729.jpg?image_size=300 will create an image with the longer side 300px. The image is stored in openatlas/tmp and deleted after request.

Discussion

  • Slideshows, again downsizing if images are too big

To consider:

  • Alternatives for projects we know in advance that they will have mainly large images (e.g. scans), should we consider something like an IIIF API?
  • Make data integrity function, which checks if all uploaded images have resized versions and if resized versions exist without the original

Updated by Bernhard Koschiček-Krombholz about 2 months ago · 29 revisions

Also available in: PDF HTML TXT