Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve compatibility with ImageMagick 7 #73

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lsix
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,12 @@ fi
if [[ "$COMSPEC" ]]; then
alias convert="magick convert" # Shun MS Windows' "convert" command.
fi


# convert has been deprecated with ImageMagick 7
if [ "$(identify -version | head -n 1 | awk '{print $3}' | cut -d'.' -f1)" -ge 7 ]; then
Copy link
Owner

@hackerb9 hackerb9 Jun 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that you were thorough, but parsing version numbers like this is notoriously brittle. Also, while I make pipelines like that at the command line all the time, in a shell script I'd prefer to avoid forking quite so many processes. For example: $(identify -version | awk 'NR==1 { print $3 >= 7 }'.

Another problem is that for many years ImageMagick 7 had all the same executables as IM6 before deprecating convert. Will identify be deprecated someday? All we know for sure is that IM6 does not have magick and IM7 does.

alias convert="magick"
fi

cleanup() {
echo -n $'\e\\' # Escape sequence to stop SIXEL.
stty echo # Reset terminal to show characters.
Expand Down