Skip to content

HEIC photos taken on iOS 18.1.1 are not being processed correctly by imagemagick #5709

Description

@tobiaseigen

This is a crosspost of a topic posted to the forum: https://help.nextcloud.com/t/does-imagemagick-need-an-update-to-support-heic-photos-from-latest-ios/211631?u=tobiaseigen. There are some more details there about my setup.

Last week, previews stopped showing up for new photos taken on my iphone and uploaded to nextcloud. I am getting thousands of errors showing up in the log. This appears to be related to a problem with imagemagick which has been fixed in recent upgrades. Do we need to upgrade the imagemagick that ships with AIO?

Seems related to this: ImageMagick/ImageMagick#7426

ImageMagick version that ships with AIO currently is 7.1.1-32. Most recent version is 7.1.1-41.

root@2024-nextcloud-ubuntu-s-2vcpu-4gb-120gb-intel-nyc3-01:~# sudo docker exec --user www-data -it nextcloud-aio-nextcloud magick --version
Version: ImageMagick 7.1.1-32 Q16-HDRI x86_64 22207 https://imagemagick.org
Copyright: (C) 1999 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP(4.5) 
Delegates (built-in): bzlib cairo fftw fontconfig freetype gslib heic jng jpeg jxl lcms ltdl lzma pangocairo png ps raw rsvg tiff webp x xml zlib zstd
Compiler: gcc (13.2)

Steps to reproduce

  1. Take some photos using iphone with iOS 18.1.1
  2. upload photos to nextcloud
  3. look at photos in nextcloud files, photos or memories

Expected behavior

expect to see photos

Actual behavior

photo icon is shown instead of photos (See screenshot)

Other information

Host OS

Ubuntu 22.04.5 LTS (GNU/Linux 5.15.0-126-generic x86_64)

Output of sudo docker info

Client: Docker Engine - Community
 Version:    27.3.1
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.17.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v2.29.7
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 8
  Running: 7
  Paused: 0
  Stopped: 1
 Images: 10
 Server Version: 27.3.1
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 Swarm: inactive
 Runtimes: io.containerd.runc.v2 runc
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: 88bf19b2105c8b17560993bee28a01ddc2f97182
 runc version: v1.2.2-0-g7cb3632
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 5.15.0-126-generic
 Operating System: Ubuntu 22.04.5 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 3.82GiB
 Name: 2024-nextcloud-ubuntu-s-2vcpu-4gb-120gb-intel-nyc3-01
 ID: 22a28764-ee23-4fd1-9df4-d685fe73e070
 Docker Root Dir: /var/lib/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled

Docker run command or docker-compose file that you used

# For Linux and without a web server or reverse proxy (like Apache, Nginx, Caddy, Cloudflare Tunnel and else) already in place:
sudo docker run \
--init \
--sig-proxy=false \
--name nextcloud-aio-mastercontainer \
--restart always \
--publish 80:80 \
--publish 8080:8080 \
--publish 8443:8443 \
--volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config \
--env NEXTCLOUD_DATADIR="/mnt/volume_nyc3_01/nextcloud" \
--env NEXTCLOUD_MEMORY_LIMIT=1024M \
--volume /var/run/docker.sock:/var/run/docker.sock:ro \
nextcloud/all-in-one:latest

Other valuable info

typical log entry - I have thousands of them now.

{"reqId":"9nw4pSuDjfpHdNkf4gSO","level":3,"time":"2024-12-05T16:29:21+00:00","remoteAddr":"73.19.12.15","user":"nnn-1","app":"core","method":"GET","url":"/core/preview?fileId=1643779&x=250&y=250","message":"File: /nnn-1/files/nnn Photos/2024/12/24-12-03 08-50-07 7496.heic Imagick says:","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36","version":"30.0.2.2","exception":{"Exception":"ImagickException","Message":"Invalid input: Unspecified: Metadata not correctly assigned to image (2.0) `/mnt/ncdata/nnn-1/files/nnn Photos/2024/12/24-12-03 08-50-07 7496.heic' @ error/heic.c/IsHEIFSuccess/144","Code":425,"Trace":[{"file":"/var/www/html/lib/private/Preview/HEIC.php","line":99,"function":"pingImage","class":"Imagick","type":"->","args":["/mnt/ncdata/nnn-1/files/nnn Photos/2024/12/24-12-03 08-50-07 7496.heic[0]"]},{"file":"/var/www/html/lib/private/Preview/HEIC.php","line":56,"function":"getResizedPreview","class":"OC\\Preview\\HEIC","type":"->","args":["/mnt/ncdata/nnn-1/files/nnn Photos/2024/12/24-12-03 08-50-07 7496.heic",2048,2048]},{"file":"/var/www/html/lib/private/Preview/GeneratorHelper.php","line":44,"function":"getThumbnail","class":"OC\\Preview\\HEIC","type":"->","args":[{"__class__":"OC\\Files\\Node\\File"},2048,2048]},{"file":"/var/www/html/lib/private/Preview/Generator.php","line":337,"function":"getThumbnail","class":"OC\\Preview\\GeneratorHelper","type":"->","args":[{"__class__":"OC\\Preview\\HEIC"},{"__class__":"OC\\Files\\Node\\File"},2048,2048]},{"file":"/var/www/html/lib/private/Preview/Generator.php","line":313,"function":"generateProviderPreview","class":"OC\\Preview\\Generator","type":"->","args":[{"__class__":"OC\\Files\\SimpleFS\\SimpleFolder"},{"__class__":"OC\\Files\\Node\\File"},2048,2048,false,true,"image/heic",""]},{"file":"/var/www/html/lib/private/Preview/Generator.php","line":119,"function":"getMaxPreview","class":"OC\\Preview\\Generator","type":"->","args":[{"__class__":"OC\\Files\\SimpleFS\\SimpleFolder"},[],{"__class__":"OC\\Files\\Node\\File"},"image/heic",""]},{"file":"/var/www/html/lib/private/Preview/Generator.php","line":86,"function":"generatePreviews","class":"OC\\Preview\\Generator","type":"->","args":[{"__class__":"OC\\Files\\Node\\File"},[{"width":250,"height":250,"crop":true,"mode":"fill"}],"image/heic"]},{"file":"/var/www/html/lib/private/PreviewManager.php","line":167,"function":"getPreview","class":"OC\\Preview\\Generator","type":"->","args":[{"__class__":"OC\\Files\\Node\\File"},250,250,true,"fill",null]},{"file":"/var/www/html/core/Controller/PreviewController.php","line":159,"function":"getPreview","class":"OC\\PreviewManager","type":"->","args":[{"__class__":"OC\\Files\\Node\\File"},250,250,true,"fill"]},{"file":"/var/www/html/core/Controller/PreviewController.php","line":123,"function":"fetchPreview","class":"OC\\Core\\Controller\\PreviewController","type":"->","args":[{"__class__":"OC\\Files\\Node\\File"},250,250,false,true,"fill",false]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":208,"function":"getPreviewByFileId","class":"OC\\Core\\Controller\\PreviewController","type":"->","args":[1643779,250,250,false,true,"fill",false]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":114,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OC\\Core\\Controller\\PreviewController"},"getPreviewByFileId"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":161,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OC\\Core\\Controller\\PreviewController"},"getPreviewByFileId"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":302,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OC\\Core\\Controller\\PreviewController","getPreviewByFileId",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"_route":"core.preview.getpreviewbyfileid"}]},{"file":"/var/www/html/lib/base.php","line":1001,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/core/preview"]},{"file":"/var/www/html/index.php","line":24,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/Preview/HEIC.php","Line":99,"message":"File: /nnn-1/files/nnn Photos/2024/12/24-12-03 08-50-07 7496.heic Imagick says:","exception":[],"CustomMessage":"File: /nnn-1/files/nnn Photos/2024/12/24-12-03 08-50-07 7496.heic Imagick says:"},"id":"6751d55c59697"}

Error when processing a newly created heic photo using magick from command line:

root@2024-nextcloud-ubuntu-s-2vcpu-4gb-120gb-intel-nyc3-01:~# sudo docker exec --user www-data -it nextcloud-aio-nextcloud magick identify -format "%m,%w,%h\n%[EXIF:*]" "/mnt/ncdata/nnn-1/files/nnn Photos/2024/12/24-12-03 08-50-07 7496.heic"
identify: Invalid input: Unspecified: Metadata not correctly assigned to image (2.0) `/mnt/ncdata/nnn-1/files/nnn Photos/2024/12/24-12-03 08-50-07 7496.heic' @ error/heic.c/IsHEIFSuccess/144.

as compared to processing an older photo that works:

root@2024-nextcloud-ubuntu-s-2vcpu-4gb-120gb-intel-nyc3-01:/mnt/volume_nyc3_01/nextcloud/backup/files/backup/Photos Library/2024/2024-01-22# sudo docker exec --user www-data -it nextcloud-aio-nextcloud magick identify -format "%m,%w,%h\n%[EXIF:*]" "/mnt/ncdata/backup/files/backup/Photos Library/2024/2024-01-22/IMG_4752.HEIC"
HEIC,4284,5712
exif:ApertureValue=171202/102901
exif:BrightnessValue=12291/69091
exif:ColorSpace=65535
exif:DateTime=2024:01:22 17:23:32
exif:DateTimeDigitized=2024:01:22 17:23:32
exif:DateTimeOriginal=2024:01:22 17:23:32
exif:ExifOffset=220
exif:ExifVersion=0232
exif:ExposureBiasValue=0/1
exif:ExposureMode=0
exif:ExposureProgram=2
exif:ExposureTime=1/60
exif:Flash=16
exif:FNumber=89/50
exif:FocalLength=343/50
exif:FocalLengthIn35mmFilm=24
exif:LensMake=Apple
exif:LensModel=iPhone 15 Pro Max back triple camera 6.86mm f/1.78
exif:LensSpecification=1551800/699009, 1551800/699009, 1551800/699009, 1551800/699009
exif:Make=Apple
exif:MakerNote=Apple iOS
exif:MeteringMode=5
exif:Model=iPhone 15 Pro Max
exif:OffsetTime=-08:00
exif:OffsetTimeDigitized=-08:00
exif:OffsetTimeOriginal=-08:00
exif:Orientation=6
exif:PhotographicSensitivity=800
exif:PixelXDimension=5712
exif:PixelYDimension=4284
exif:ResolutionUnit=2
exif:SceneType=.
exif:SensingMethod=2
exif:ShutterSpeedValue=73847/12503
exif:Software=17.2.1
exif:SubjectArea=1087, 1087, 1087, 1087
exif:SubSecTimeDigitized=976
exif:SubSecTimeOriginal=976
exif:WhiteBalance=0
exif:XResolution=72/1
exif:YResolution=72/1

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending approval or rejection. This issue is pending approval.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions