How can I run ImageMagick from a shell_command?

The problem is that the imagemagick has to run within the Home Assistant Core container, instead of the ssh container. The other problem is when you update HA Core, the installed imagemagick is deleted and has to be re-installed.

To install imagemagick in HA Core including after an update, here is what I do:
create a shell command file (I named mine add_imagemagick.sh) under config/shell_commands that contains the following:

#!/bin/bash

if ! test -f "/usr/bin/convert"; then
    apk add imagemagick
fi

Note: technically you could instead test for the presence of the file /usr/bin/magick instead of /usr/bin/convert as convert is now just a symbolic link to the real file magick.

Create the shell command in your yaml config:

shell_command:
  imagemagick_add: /config/shell_commands/add_imagemagick.sh

Create an automation that runs at homeassistant startup time

action:
  - data: {}
    action: shell_command.imagemagick_add

At this point you should be able to run your conf_jpg_pnp shell command.