使用 ImageMagick 的 HEIC 操作产生无效输出

如何解决使用 ImageMagick 的 HEIC 操作产生无效输出

这些操作有效:

  • HEIC 转换为其他格式,例如转换 IMG_8293.HEIC c.jpg

这些操作产生无效的输出:

  • 将任何格式转换为HEIC,例如:convert c.jpg c.heic
  • 旋转 HEIC:转换 IMG_8293.HEIC -旋转 90 IMG_8293.HEIC
  • 其他 HEIC 操作,例如翻牌、翻牌等

无效输出意味着:元数据​​显示正确,但 MacOS 预览提示:“The file “c.heic” could not be opened. It may be damaged or use a file format that Preview doesn’t recognise.”。

输入文件c.jpg的元数据

c.jpg: JPEG image data,JFIF standard 1.01,resolution (DPI),density 72x72,segment length 16,Exif Standard: [TIFF image data,big-endian,direntries=11,manufacturer=Apple,model=iPhone 11 Pro,orientation=upper-left,xresolution=166,yresolution=174,resolutionunit=2,software=14.0.1,datetime=2021:06:15 17:59:12,GPS-Data],baseline,precision 8,3024x4032,components 3

ExifTool Version Number         : 12.26
File Name                       : c.jpg
Directory                       : /Users/pepa/Downloads/imageTests/a
File Size                       : 3.4 MiB
File Modification Date/Time     : 2021:06:21 14:45:17+02:00
File Access Date/Time           : 2021:06:21 14:55:02+02:00
File Inode Change Date/Time     : 2021:06:21 14:55:01+02:00
File Permissions                : -rw-r--r--
File Type                       : JPEG
File Type Extension             : jpg
MIME Type                       : image/jpeg
JFIF Version                    : 1.01
Exif Byte Order                 : Big-endian (Motorola,MM)
Make                            : Apple
Camera Model Name               : iPhone 11 Pro
Orientation                     : Horizontal (normal)
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Software                        : 14.0.1
Modify Date                     : 2021:06:15 17:59:12
Y Cb Cr Positioning             : Centered
Exposure Time                   : 1/60
F Number                        : 1.8
Exposure Program                : Program AE
ISO                             : 125
Exif Version                    : 0231
Date/Time Original              : 2021:06:15 17:59:12
Create Date                     : 2021:06:15 17:59:12
Offset Time                     : +02:00
Offset Time Original            : +02:00
Offset Time Digitized           : +02:00
Components Configuration        : Y,Cb,Cr,-
Shutter Speed Value             : 1/60
Aperture Value                  : 1.8
Brightness Value                : 3.03912093
Exposure Compensation           : 0
Metering Mode                   : Multi-segment
Flash                           : Auto,Did not fire
Focal Length                    : 4.2 mm
Subject Area                    : 2002 1505 2213 1324
Run Time Flags                  : Valid
Run Time Value                  : 177843221492583
Run Time Scale                  : 1000000000
Run Time Epoch                  : 0
Acceleration Vector             : 0.008651109405 -0.003601103323 -1.025277733
Sub Sec Time Original           : 185
Sub Sec Time Digitized          : 185
Flashpix Version                : 0100
Color Space                     : Uncalibrated
Exif Image Width                : 4032
Exif Image Height               : 3024
Sensing Method                  : One-chip color area
Scene Type                      : Directly photographed
Exposure Mode                   : Auto
White Balance                   : Auto
Focal Length In 35mm Format     : 26 mm
Scene Capture Type              : Standard
Lens Info                       : 1.539999962-6mm f/1.8-2.4
Lens Make                       : Apple
Lens Model                      : iPhone 11 Pro back triple camera 4.25mm f/1.8
Composite Image                 : General Composite Image
GPS Latitude Ref                : North
GPS Longitude Ref               : East
GPS Altitude Ref                : Above Sea Level
GPS Speed Ref                   : km/h
GPS Speed                       : 0
GPS Img Direction Ref           : True North
GPS Img Direction               : 71.31763456
GPS Dest Bearing Ref            : True North
GPS Dest Bearing                : 71.31763456
GPS Date Stamp                  : 2021:06:15
GPS Horizontal Positioning Error: 65 m
Profile CMM Type                : Apple Computer Inc.
Profile Version                 : 4.0.0
Profile Class                   : Display Device Profile
Color Space Data                : RGB
Profile Connection Space        : XYZ
Profile Date Time               : 2017:07:07 13:22:32
Profile File Signature          : acsp
Primary Platform                : Apple Computer Inc.
CMM Flags                       : Not Embedded,Independent
Device Manufacturer             : Apple Computer Inc.
Device Model                    : 
Device Attributes               : Reflective,Glossy,Positive,Color
Rendering Intent                : Perceptual
Connection Space Illuminant     : 0.9642 1 0.82491
Profile Creator                 : Apple Computer Inc.
Profile ID                      : ca1a9582257f104d389913d5d1ea1582
Profile Description             : Display P3
Profile Copyright               : Copyright Apple Inc.,2017
Media White Point               : 0.95045 1 1.08905
Red Matrix Column               : 0.51512 0.2412 -0.00105
Green Matrix Column             : 0.29198 0.69225 0.04189
Blue Matrix Column              : 0.1571 0.06657 0.78407
Red Tone Reproduction Curve     : (Binary data 32 bytes,use -b option to extract)
Chromatic Adaptation            : 1.04788 0.02292 -0.0502 0.02959 0.99048 -0.01706 -0.00923 0.01508 0.75168
Blue Tone Reproduction Curve    : (Binary data 32 bytes,use -b option to extract)
Green Tone Reproduction Curve   : (Binary data 32 bytes,use -b option to extract)
Image Width                     : 3024
Image Height                    : 4032
Encoding Process                : Baseline DCT,Huffman coding
Bits Per Sample                 : 8
Color Components                : 3
Y Cb Cr Sub Sampling            : YCbCr4:4:4 (1 1)
Run Time Since Power Up         : 2 days 1:24:03
Aperture                        : 1.8
Image Size                      : 3024x4032
Megapixels                      : 12.2
Scale Factor To 35 mm Equivalent: 6.1
Shutter Speed                   : 1/60
Create Date                     : 2021:06:15 17:59:12.185+02:00
Date/Time Original              : 2021:06:15 17:59:12.185+02:00
Modify Date                     : 2021:06:15 17:59:12+02:00
GPS Altitude                    : 255.7 m Above Sea Level
GPS Latitude                    : 49 deg 59' 50.66" N
GPS Longitude                   : 14 deg 25' 29.76" E
Circle Of Confusion             : 0.005 mm
Field Of View                   : 69.4 deg
Focal Length                    : 4.2 mm (35 mm equivalent: 26.0 mm)
GPS Position                    : 49 deg 59' 50.66" N,14 deg 25' 29.76" E
Hyperfocal Distance             : 2.04 m
Light Value                     : 7.3
Lens ID                         : iPhone 11 Pro back triple camera 4.25mm f/1.8

损坏文件 c.heic 的元数据:

c.heic: ISO Media,HEIF Image HEVC Main or Main Still Picture Profile


ExifTool Version Number         : 12.26
File Name                       : c.heic
Directory                       : /Users/pepa/Downloads/imageTests/a
File Size                       : 1592 KiB
File Modification Date/Time     : 2021:06:21 14:53:11+02:00
File Access Date/Time           : 2021:06:21 14:55:02+02:00
File Inode Change Date/Time     : 2021:06:21 14:55:01+02:00
File Permissions                : -rw-r--r--
File Type                       : HEIC
File Type Extension             : heic
MIME Type                       : image/heic
Major Brand                     : High Efficiency Image Format HEVC still image (.HEIC)
Minor Version                   : 0.0.0
Compatible Brands               : mif1,heic
Handler Type                    : Picture
Primary Item Reference          : 1
Orientation                     : Horizontal (normal)
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Y Cb Cr Positioning             : Centered
White Balance                   : Auto
Exif Byte Order                 : Big-endian (Motorola,MM)
Make                            : Apple
Camera Model Name               : iPhone 11 Pro
Software                        : 14.0.1
Modify Date                     : 2021:06:15 17:59:12
Exposure Time                   : 1/60
F Number                        : 1.8
Exposure Program                : Program AE
ISO                             : 125
Exif Version                    : 0231
Date/Time Original              : 2021:06:15 17:59:12
Create Date                     : 2021:06:15 17:59:12
Offset Time                     : +02:00
Offset Time Original            : +02:00
Offset Time Digitized           : +02:00
Components Configuration        : Y,Did not fire
Focal Length                    : 4.2 mm
Subject Area                    : 2002 1505 2213 1324
Run Time Flags                  : Valid
Run Time Value                  : 177843221492583
Run Time Scale                  : 1000000000
Run Time Epoch                  : 0
Acceleration Vector             : 0.008651109405 -0.003601103323 -1.025277733
Sub Sec Time Original           : 185
Sub Sec Time Digitized          : 185
Flashpix Version                : 0100
Color Space                     : Uncalibrated
Exif Image Width                : 4032
Exif Image Height               : 3024
Sensing Method                  : One-chip color area
Scene Type                      : Directly photographed
Exposure Mode                   : Auto
Focal Length In 35mm Format     : 26 mm
Scene Capture Type              : Standard
Lens Info                       : 1.539999962-6mm f/1.8-2.4
Lens Make                       : Apple
Lens Model                      : iPhone 11 Pro back triple camera 4.25mm f/1.8
Composite Image                 : General Composite Image
GPS Latitude Ref                : North
GPS Longitude Ref               : East
GPS Altitude Ref                : Above Sea Level
GPS Speed Ref                   : km/h
GPS Speed                       : 0
GPS Img Direction Ref           : True North
GPS Img Direction               : 71.31763456
GPS Dest Bearing Ref            : True North
GPS Dest Bearing                : 71.31763456
GPS Date Stamp                  : 2021:06:15
GPS Horizontal Positioning Error: 65 m
HEVC Configuration Version      : 1
General Profile Space           : Conforming
General Tier Flag               : Main Tier
General Profile IDC             : Main Still Picture
Gen Profile Compatibility Flags : Main Still Picture,Main 10,Main
Constraint Indicator Flags      : 0 0 0 0 0 0
General Level IDC               : 180 (level 6.0)
Min Spatial Segmentation IDC    : 0
Parallelism Type                : 0
Chroma Format                   : 4:2:0
Bit Depth Luma                  : 8
Bit Depth Chroma                : 8
Average Frame Rate              : 0
Constant Frame Rate             : Unknown
Num Temporal Layers             : 1
Temporal ID Nested              : Yes
Color Representation            : nclx 2 2 6
Image Pixel Depth               : 8 8 8
Media Data Size                 : 1629724
Media Data Offset               : 470
Run Time Since Power Up         : 2 days 1:24:03
Aperture                        : 1.8
Scale Factor To 35 mm Equivalent: 6.1
Shutter Speed                   : 1/60
Create Date                     : 2021:06:15 17:59:12.185+02:00
Date/Time Original              : 2021:06:15 17:59:12.185+02:00
Modify Date                     : 2021:06:15 17:59:12+02:00
GPS Altitude                    : 255.7 m Above Sea Level
GPS Latitude                    : 49 deg 59' 50.66" N
GPS Longitude                   : 14 deg 25' 29.76" E
Circle Of Confusion             : 0.005 mm
Field Of View                   : 69.4 deg
Focal Length                    : 4.2 mm (35 mm equivalent: 26.0 mm)
GPS Position                    : 49 deg 59' 50.66" N,14 deg 25' 29.76" E
Hyperfocal Distance             : 2.04 m
Light Value                     : 7.3
Lens ID                         : iPhone 11 Pro back triple camera 4.25mm f/1.8

ImageMagick --version

Version: ImageMagick 7.0.10-59 Q16 x86_64 2021-01-24 https://imagemagick.org
Copyright: (C) 1999-2021 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP(4.5) 
Delegates (built-in): bzlib freetype gslib heic jng jp2 jpeg lcms lqr ltdl lzma openexr png ps tiff webp xml zlib

换句话说,每次输出为 HEIC 时,输出都已损坏。知道为什么吗?

解决方法

升级到最新的 7.1.0 版本解决了这个问题。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams['font.sans-serif'] = ['SimHei'] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -> systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping("/hires") public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate<String
使用vite构建项目报错 C:\Users\ychen\work>npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-
参考1 参考2 解决方案 # 点击安装源 协议选择 http:// 路径填写 mirrors.aliyun.com/centos/8.3.2011/BaseOS/x86_64/os URL类型 软件库URL 其他路径 # 版本 7 mirrors.aliyun.com/centos/7/os/x86
报错1 [root@slave1 data_mocker]# kafka-console-consumer.sh --bootstrap-server slave1:9092 --topic topic_db [2023-12-19 18:31:12,770] WARN [Consumer clie
错误1 # 重写数据 hive (edu)> insert overwrite table dwd_trade_cart_add_inc > select data.id, > data.user_id, > data.course_id, > date_format(
错误1 hive (edu)> insert into huanhuan values(1,'haoge'); Query ID = root_20240110071417_fe1517ad-3607-41f4-bdcf-d00b98ac443e Total jobs = 1
报错1:执行到如下就不执行了,没有显示Successfully registered new MBean. [root@slave1 bin]# /usr/local/software/flume-1.9.0/bin/flume-ng agent -n a1 -c /usr/local/softwa
虚拟及没有启动任何服务器查看jps会显示jps,如果没有显示任何东西 [root@slave2 ~]# jps 9647 Jps 解决方案 # 进入/tmp查看 [root@slave1 dfs]# cd /tmp [root@slave1 tmp]# ll 总用量 48 drwxr-xr-x. 2
报错1 hive> show databases; OK Failed with exception java.io.IOException:java.lang.RuntimeException: Error in configuring object Time taken: 0.474 se
报错1 [root@localhost ~]# vim -bash: vim: 未找到命令 安装vim yum -y install vim* # 查看是否安装成功 [root@hadoop01 hadoop]# rpm -qa |grep vim vim-X11-7.4.629-8.el7_9.x
修改hadoop配置 vi /usr/local/software/hadoop-2.9.2/etc/hadoop/yarn-site.xml # 添加如下 <configuration> <property> <name>yarn.nodemanager.res