Use magick command from ImageMagick #1101

Merged
Oneric merged 2 commits from norm/akkoma:magick into develop 2026-04-02 20:42:10 +00:00
Contributor

Based on !854, but with the following changes:

  • Reverts changes to the mogrify command as it's not deprecated in IM 7
  • Fallback to convert for older IM versions
  • check_filter takes a list instead of a single command
  • Rebased onto latest develop
Based on !854, but with the following changes: - Reverts changes to the `mogrify` command as it's not deprecated in IM 7 - Fallback to `convert` for older IM versions - `check_filter` takes a list instead of a single command - Rebased onto latest develop
With ImageMagick version 7 the convert command has been deprecated in
favour of magick. Calling convert instead results in the logs being
spammed with warning messages.

The mogrify Elixir wrapper also runs magick with the mogrify argument
in current releases.
Make `check_filter` more flexible by checking a list instead of a single
command, and also use the `mogrify` command for the Mogrify filters, as
it's not deprecated.
fix format
All checks were successful
ci/woodpecker/pr/test/2 Pipeline was successful
ci/woodpecker/pr/test/1 Pipeline was successful
7b662d793e
Oneric left a comment
Owner

Given we already repeatedly research PATH for the command anyway instead of caching it implies the overhead is (assumed to be) neglible and thus potentially doubling it for IMv6 setups shouldn’t be an issue and avoids the need for a config options for our own code; neat.

In !854 i mentioned the external Mogrify module still uses plain convert except on Windows by default (but can be configured to use any path) meaning we could still see deprecation warnings from there. However, looking closer, Mogrify only uses convert in functions we don’t use, or save/2 without in_place: true but we always use the latter option.

convert and magick are actually not drop-in compatible, the latter is stricter about argument ordering, but given we only saw deprecation warning but no errors with IMv7 so far it seems the args we construct are fine.

I guess this means this should successfully banish all deprecation warnings without breaking compat and (presumed) negligible overhead (and only on IMv6 setups). Seems good; thank you!

Just a minor nit

Given we already repeatedly research `PATH` for the command anyway instead of caching it implies the overhead is (assumed to be) neglible and thus potentially doubling it for IMv6 setups shouldn’t be an issue and avoids the need for a config options for our own code; neat. In !854 i mentioned the external `Mogrify` module still uses plain `convert` except on Windows by default *(but can be configured to use any path)* meaning we could still see deprecation warnings from there. However, looking closer, Mogrify only uses convert in functions we don’t use, or `save/2` _without_ `in_place: true` but we always use the latter option. `convert` and `magick` are actually not drop-in compatible, the latter is stricter about argument ordering, but given we only saw deprecation warning but no errors with IMv7 so far it seems the args we construct are fine. I guess this means this should successfully banish all deprecation warnings without breaking compat and (presumed) negligible overhead (and only on IMv6 setups). Seems good; thank you! Just a minor nit
@ -227,2 +227,2 @@
"#{filter} is specified in list of Pleroma.Upload filters, but the " <>
"#{command_required} command is not found"
"#{filter} is specified in list of Pleroma.Upload filters, but none of the commands in " <>
"#{commands_required} are found"
Owner

directly interpolating a list of binaries here, will just concat the command names without any seperation. Instead this should use [#{Enum.join(commands_required, ", ")}] to specify sane separators and visibly group the list content

iex(1)> "#{["bbb", "a"]}"
"bbba"
directly interpolating a list of binaries here, will just concat the command names without any seperation. Instead this should use `[#{Enum.join(commands_required, ", ")}]` to specify sane separators and visibly group the list content ```elixir iex(1)> "#{["bbb", "a"]}" "bbba" ```
Oneric marked this conversation as resolved
Oneric force-pushed magick from 7b662d793e
All checks were successful
ci/woodpecker/pr/test/2 Pipeline was successful
ci/woodpecker/pr/test/1 Pipeline was successful
to a14a369a3f
All checks were successful
ci/woodpecker/pr/test/2 Pipeline was successful
ci/woodpecker/pr/test/1 Pipeline was successful
2026-04-02 19:30:12 +00:00
Compare
Oneric merged commit 1f268809df into develop 2026-04-02 20:42:10 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
AkkomaGang/akkoma!1101
No description provided.