fix: use native Imagick for AVIF and HEIC output instead of magick convert#43
fix: use native Imagick for AVIF and HEIC output instead of magick convert#43
Conversation
…nvert The shell-based `magick convert` path is unreliable in containerised environments where the binary may not be on PATH, and is unnecessary because ImageMagick 7 (with the heic/avif delegates built in) exposes AVIF and HEIC encoding directly through the Imagick PHP extension. Switch the avif/heic case to the same native pattern used by jpg, png, and gif: setImageCompressionQuality + setImageFormat, then let the shared getImagesBlob/writeImages path handle output. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Greptile SummaryThis PR replaces the shell-exec-based Confidence Score: 5/5Safe to merge — clean refactor with no new bugs introduced and a real reliability problem fixed. All findings are P2 or lower. The core logic correctly mirrors the existing jpg/png/gif pattern, the quality quirk is well-documented and technically justified, and the prior resource-cleanup concern (blob path) pre-exists across all formats and was already noted. No blocking issues remain. No files require special attention. Important Files Changed
Reviews (3): Last reviewed commit: "fix: use setCompressionQuality for AVIF/..." | Re-trigger Greptile |
…essionQuality setImageCompressionQuality() is silently ignored by the libheif coder in the Imagick PHP extension — quality had no effect and all output was encoded at the default level regardless of the requested value. The fix is to call setCompressionQuality() (object-level) after setImageFormat(), which correctly passes quality through to libheif. See: Imagick/imagick#711 Also updates the HEIC q100 expected file size in tests (8426 → 8490) to reflect the minor encoding difference between native Imagick and the old magick convert path at the same quality level. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
magick convert, which is unreliable in containerised environments where the binary may not be onPATHavif/heiccase to the same native pattern used byjpg,png, andgif:setImageCompressionQuality+setImageFormat, then let the sharedgetImagesBlob/writeImagespath handle outputTest plan
image/avifcontent-type and non-empty bodyimage/heiccontent-type and non-empty body🤖 Generated with Claude Code