Search code examples
screenshotarchlinuximagemagick-convert

ImageMagick Invalid Image Index


A week ago I followed this tutorial, and it successfully worked (even with some changes I did), but today it just won't work.

The edited code is this:

SCREENSHOTFOLDER="/home/pk/screenshots"

FILE="${1}"
FILENAME="${FILE##*/}"
FILEBASE="${FILENAME%.*}"

# drop shadow: 60% opacity, 10 sigma, +0x +10y
convert "${FILE}" \( +clone -background black -shadow 70x15+5+10 \) +swap -background white -layers merge +repage "$SCREENSHOTFOLDER/${FILEBASE}.png"

notify-send -u critical -t 1 "${FILEBASE}.png saved."

xclip -selection clipboard -t image/png -i "$SCREENSHOTFOLDER/${FILEBASE}.png" 

that code is run by this script:

 escrotum -s -e '/home/pk/ss/dropshadow-c.sh $f'

then, I tried to debug it but when I run escrotum -s -e '/home/pk/ss/dropshadow-c.sh $f' I get this:

convert: invalid image index `2021-04-18-201820_839x396_escrotum.png' @ error/list.c/CloneImages/282.
convert: no such image `+clone' @ error/convert.c/ConvertImageCommand/1027.
xclip: /home/pk/screenshots/2021-04-18-201820_839x396_escrotum.png: No such file or directory

Solution

  • The problem was that ImageMagick has a bug in the version I used, I downgrade it and it works.