Skip to content

Photo

Automatically crop pictures from a scan

Install

sudo apt install imagemagick bc

Download multicrop

Run

 ./multicrop -u 1 scan_pics.jpg extracted_pic.jpg

It will generate extracted_pic-000.jpg extracted_pic-001.jpg … depending on number of pictures found in scan_pics.jpg.

To run it on all scan in the current folder:

for f in *.jpg; do
    ./multicrop -u 1 "$f" "output/extracted_$f"
done

Convert HEIC into JPG

Install

sudo apt install imagemagick

Be careful

magick must be >= 7.0.0, so Ubuntu must be at least 25.04

Run

For one picture

magick picture.HEIC picture.jpg

For all HEIC pictures in the current folder

for f in *.HEIC; do magick $f ${f%.HEIC}.jpg; done