Skip to content

Autoscale images for display #3232

Description

@mbradley612

Description

Anthias v2026.7.4 (7fe850c) on RPi 4.

We use the wonderful Anthias to provide images of sailing at our sailing club. Members take photos on their digital cameras which we upload using the "add asset" feature. The display is a Philips TV which Anthias reports as having resolution 3840x2160.

The problem we have is that Anthias

  1. does not size landscape pictures to fit the display and
  2. fails to interpret the orientation information of portrait pictures which appear rotated 90 degrees. In contrast a Mac Quick Look or Preview interprets the orientation correctly. See example attached of a Portrait image that Anthias rotates 90 degrees.

Solution

Our workaround is a bash script that we run before uploading the images to Anthias. The script uses imagemagick to query, resize and orientate the images. The script determines whether the image is portrait or landscape using the EXIF info, then rescales to the size of the display with black borders around portrait images. The result is very effective.

#!/bin/bash
# Enable case-insensitive wildcard matching and prevent loops over non-existent files
shopt -s nocaseglob nullglob

for img in originals/*.jpg; do
  # Determine dimensions after applying EXIF orientation
  read -r width height < <(magick identify -auto-orient -format "%w %h" "$img[0]")

  if [ "$width" -ge "$height" ]; then
    echo "Processing [LANDSCAPE]: $img (${width}x${height})"
    # Fill 3840x2160 canvas and crop top/bottom overflow
    magick "$img" -verbose -auto-orient -resize "3840x2160^" -gravity center -background black -extent 3840x2160 "processed/$(basename "$img")"
  else
    echo "Processing [PORTRAIT]: $img (${width}x${height})"
    # Scale inside 3840x2160 canvas (no crop) and add black sidebars
    magick "$img" -verbose -auto-orient -resize "3840x2160" -gravity center -background black -extent 3840x2160 "processed/$(basename "$img")"
  fi
done

It would be enormously helpful to add equivalent processing logic to the Anthias asset upload pipeline so that:

  1. Landscape images are resized to the size of the display and
  2. Portrait images are resized to the height of the display with a black background.

Happy to provide more example images if helpful.

Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions