Due to a problem with the SMTP Integration and images generated with the camera.snapshot action, I need to use ImageMagick to fixup the JPEG images. In a nutshell, the SMTP Integration claims to not recognize the JPEG format of the images generated by camera.snapshot. If I use magick image.jpg image.jpg to re-encode the JPEG image created by camera.snapshot, then the SMTP Integration has no problems with them.
I’m running HAOS 14.2 on an Intel NUC. The problem I’m having is that I need to install ImageMagick in the docker that HA is running in. If I use the command line in Advanced SSH & Web Terminal I can load ImageMagick and the JPEG delegate and manually re-encode the image so it works.
➜ ~ apk --update add imagemagick && apk --no-cache add msttcorefonts-installer fontconfig && update-ms-fonts && fc-cache -f
fetch https://dl-cdn.alpinelinux.org/alpine/v3.21/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.21/community/x86_64/APKINDEX.tar.gz
OK: 262 MiB in 249 packages
fetch https://dl-cdn.alpinelinux.org/alpine/v3.21/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.21/community/x86_64/APKINDEX.tar.gz
OK: 262 MiB in 249 packages
.
.
.
➜ ~ apk add imagemagick-jpeg
(1/2) Installing libjpeg-turbo (3.0.4-r0)
(2/2) Installing imagemagick-jpeg (7.1.1.41-r0)
OK: 263 MiB in 251 packages
➜ ~ magick "/config/www/snapshots/AI Pro Driveway_snapshot2.jpg" "/config/www/snapshots/AI Pro Driveway_snapshot2.jpg"
➜ ~
So, I know it can work. In order to get it to run from an automation, in need to load the packages inside the HA container. However, inside the container, APK cannot find the imagemagick-jpeg package. If I run the two commands using the the add-on File Editor “Execute Shell Command” dialog, it installs the ImageMAgick package without problems, but fails to load the ImageMagick-jpeg package.
Execute shell command
Command executed: apk --update add imagemagick && apk --no-cache add msttcorefonts-installer fontconfig && update-ms-fonts && fc-cache -f: 0
fetch https://dl-cdn.alpinelinux.org/alpine/v3.19/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.19/community/x86_64/APKINDEX.tar.gz
(1/20) Installing libpng (1.6.44-r0)
(2/20) Installing freetype (2.13.2-r0)
(3/20) Installing fontconfig (2.14.2-r4)
(4/20) Installing libxau (1.0.11-r3)
(5/20) Installing libmd (1.1.0-r0)
(6/20) Installing libbsd (0.11.7-r3)
(7/20) Installing libxdmcp (1.1.4-r3)
(8/20) Installing libxcb (1.16-r0)
(9/20) Installing libx11 (1.8.7-r0)
(10/20) Installing libxext (1.3.5-r3)
(11/20) Installing fftw-double-libs (3.3.10-r5)
(12/20) Installing libgomp (13.2.1_git20231014-r0)
(13/20) Installing lcms2 (2.15-r4)
(14/20) Installing libltdl (2.4.7-r3)
(15/20) Installing imagemagick-libs (7.1.1.32-r0)
(16/20) Installing imagemagick (7.1.1.32-r0)
(17/20) Installing libmspack (0.11_alpha-r1)
(18/20) Installing cabextract (1.11-r1)
(19/20) Installing wget (1.21.4-r0)
(20/20) Installing msttcorefonts-installer (3.8.1-r0)
Executing msttcorefonts-installer-3.8.1-r0.post-install
Executing busybox-1.36.1-r15.trigger
Executing fontconfig-2.14.2-r4.trigger
OK: 122 MiB in 91 packages
*
* With root permissions run "update-ms-fonts" and once completed
* run "fc-cache -f" in order to update the font cache
*
Execute shell command
Command executed: apk add imagemagick-jpeg: 5
fetch https://dl-cdn.alpinelinux.org/alpine/v3.19/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.19/community/x86_64/APKINDEX.tar.gz
ERROR: unable to select packages:
&& (no such package):
required by: world[&&]
add (no such package):
required by: world[add]
apk (no such package):
required by: world[apk]
fc-cache (no such package):
required by: world[fc-cache]
update-ms-fonts (no such package):
required by: world[update-ms-fonts]
Without the jpeg delegate, magick fails:
Execute shell command
Command executed: magick "./www/snapshots/AI Pro Driveway_snapshot2.jpg" "./www/snapshots/AI Pro Driveway_snapshot2.jpg": 1
magick: no decode delegate for this image format `JPEG' @ error/constitute.c/ReadImage/746.
Any ideas on how I can fix this?