heicをjpegに変換する時
convert image.heic image.jpeg で良い。 こうするとexifもカラープロファイルも維持されたまま変換される。
qualityは手元では92になった(この数字はどこから?)。望むなら100にすれば良いか。
exifを消したい時は http://blog.awm.jp/2017/06/11/imicc/#お勧めコマンド のままやってやると良さそう。
以下ここまでのあらすじと確認したところ。
— なな(久我山 菜々)🐇🏰🕛🥕 (@nonamea774) March 8, 2020
という疑問が出た。
あとは Exif を引き継ぐかどうかもチェック要素かも。 https://t.co/IQYgzgtyAU
— \助けよや/ (@yoya) March 8, 2020
ExifTools の Exif(+α)ダンプ機能は HEIF/HEIC にも対応してて、最新の ImageMagick の convert で変換した JPEG と比較してみた感じ、きちんと引き継げてる気がする。 pic.twitter.com/TNYehutEwl
— \助けよや/ (@yoya) March 8, 2020
まず手元のImageMagickが6.9系だったのでHEICをサポートしてるところまで上げる。
https://qiita.com/kinoleaf/items/df93150874bf0a6c9b9d#imagemagickのサポート状況 7.0.8-46とかその周辺らしい?
現在の最新の7.0.10-0をダウンロードしてきて
--with-heic をつけてビルド(libheif-devを入れておくと良さそうな気がした)。convertconvert orig.heic out.jpegdiffdiff -u heic jpeg--- heic 2020-03-08 23:48:58.151954000 +0900+++ jpeg 2020-03-08 23:49:23.841282300 +0900@@ -1,19 +1,15 @@ ExifTool Version Number : 11.65-File Name : orig.heic+File Name : out.jpeg Directory : .-File Size : 2.1 MB-File Modification Date/Time : 2020:03:08 23:22:09+09:00-File Access Date/Time : 2020:03:08 23:22:09+09:00-File Inode Change Date/Time : 2020:03:08 23:45:47+09:00+File Size : 3.2 MB+File Modification Date/Time : 2020:03:08 23:49:14+09:00+File Access Date/Time : 2020:03:08 23:22:40+09:00+File Inode Change Date/Time : 2020:03:08 23:49:14+09:00 File Permissions : rw-rw-rw--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, miaf, MiHB, heic-Handler Type : Picture-Primary Item Reference : 49+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@@ -103,29 +99,12 @@ 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)-HEVC Configuration Version : 1-General Profile Space : Conforming-General Tier Flag : Main Tier-General Profile IDC : Main Still Picture Profile-Gen Profile Compatibility Flags : Main Still Picture, Main 10, Main-Constraint Indicator Flags : 176 0 0 0 0 0-General Level IDC : 90 (level 3.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 : No Image Width : 4032 Image Height : 3024-Image Spatial Extent : 4032x3024-Rotation : 0-Image Pixel Depth : 8 8 8-Movie Data Size : 2169087-Movie Data Offset : 3428+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 : 3 days 21:19:35 Aperture : 2.4 Image Size : 4032x3024convertで変換しても、exifはだいたい保持されてそう。
icc$ convert out.jpeg out.icc$ file out.iccout.icc: ColorSync color profile 4.0, type appl, RGB/XYZ-mntr device by appl, 548 bytes, 7-7-2017 13:22:32, 0xca1a9582257f104d MD5 "Display P3"iccプロファイルも保持されているのでOK。
orig.heif$ exiftool orig.heic | tee heicExifTool Version Number : 11.65File Name : orig.heicDirectory : .File Size : 2.1 MBFile Modification Date/Time : 2020:03:08 23:22:09+09:00File Access Date/Time : 2020:03:08 23:22:09+09:00File Inode Change Date/Time : 2020:03:08 23:45:47+09:00File Permissions : rw-rw-rw-File Type : HEICFile Type Extension : heicMIME Type : image/heicMajor Brand : High Efficiency Image Format HEVC still image (.HEIC)Minor Version : 0.0.0Compatible Brands : mif1, miaf, MiHB, heicHandler Type : PicturePrimary Item Reference : 49Exif Byte Order : Big-endian (Motorola, MM)Make : AppleCamera Model Name : iPhone 11Orientation : Horizontal (normal)X Resolution : 72Y Resolution : 72Resolution Unit : inchesSoftware : 13.3.1Modify Date : 2020:03:07 16:18:29Y Cb Cr Positioning : CenteredExposure Time : 1/500F Number : 2.4Exposure Program : Program AEISO : 20Exif Version : 0231Date/Time Original : 2020:03:07 16:18:29Create Date : 2020:03:07 16:18:29Offset Time : +09:00Offset Time Original : +09:00Offset Time Digitized : +09:00Components Configuration : Y, Cb, Cr, -Shutter Speed Value : 1/500Aperture Value : 2.4Brightness Value : 8.968155267Exposure Compensation : 0Metering Mode : Multi-segmentFlash : Off, Did not fireFocal Length : 1.5 mmSubject Area : 2015 1510 2323 1392Run Time Flags : ValidRun Time Value : 335975424399875Run Time Scale : 1000000000Run Time Epoch : 0Acceleration Vector : -0.9370931979 -0.01936975682 0.3228254023Content Identifier : 16488392-0B18-41F3-8C47-80F640D3EDA6Sub Sec Time Original : 543Sub Sec Time Digitized : 543Flashpix Version : 0100Color Space : UncalibratedExif Image Width : 4032Exif Image Height : 3024Sensing Method : One-chip color areaScene Type : Directly photographedExposure Mode : AutoWhite Balance : AutoDigital Zoom Ratio : 1.022312373Focal Length In 35mm Format : 14 mmScene Capture Type : StandardLens Info : 1.54-4.25mm f/1.8-2.4Lens Make : AppleLens Model : iPhone 11 back dual wide camera 1.54mm f/2.4Composite Image : General Composite ImageGPS Latitude Ref : NorthGPS Longitude Ref : EastGPS Altitude Ref : Above Sea LevelGPS Speed Ref : km/hGPS Speed : 0.687995255GPS Img Direction Ref : True NorthGPS Img Direction : 97.10734846GPS Dest Bearing Ref : True NorthGPS Dest Bearing : 97.10734846GPS Date Stamp : 2020:03:07GPS Horizontal Positioning Error: 22.8772038 mProfile CMM Type : Apple Computer Inc.Profile Version : 4.0.0Profile Class : Display Device ProfileColor Space Data : RGBProfile Connection Space : XYZProfile Date Time : 2017:07:07 13:22:32Profile File Signature : acspPrimary Platform : Apple Computer Inc.CMM Flags : Not Embedded, IndependentDevice Manufacturer : Apple Computer Inc.Device Model :Device Attributes : Reflective, Glossy, Positive, ColorRendering Intent : PerceptualConnection Space Illuminant : 0.9642 1 0.82491Profile Creator : Apple Computer Inc.Profile ID : ca1a9582257f104d389913d5d1ea1582Profile Description : Display P3Profile Copyright : Copyright Apple Inc., 2017Media White Point : 0.95045 1 1.08905Red Matrix Column : 0.51512 0.2412 -0.00105Green Matrix Column : 0.29198 0.69225 0.04189Blue Matrix Column : 0.1571 0.06657 0.78407Red 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.75168Blue 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)HEVC Configuration Version : 1General Profile Space : ConformingGeneral Tier Flag : Main TierGeneral Profile IDC : Main Still Picture ProfileGen Profile Compatibility Flags : Main Still Picture, Main 10, MainConstraint Indicator Flags : 176 0 0 0 0 0General Level IDC : 90 (level 3.0)Min Spatial Segmentation IDC : 0Parallelism Type : 0Chroma Format : 4:2:0Bit Depth Luma : 8Bit Depth Chroma : 8Average Frame Rate : 0Constant Frame Rate : UnknownNum Temporal Layers : 1Temporal ID Nested : NoImage Width : 4032Image Height : 3024Image Spatial Extent : 4032x3024Rotation : 0Image Pixel Depth : 8 8 8Movie Data Size : 2169087Movie Data Offset : 3428Run Time Since Power Up : 3 days 21:19:35Aperture : 2.4Image Size : 4032x3024Megapixels : 12.2Scale Factor To 35 mm Equivalent: 9.1Shutter Speed : 1/500Create Date : 2020:03:07 16:18:29.543+09:00Date/Time Original : 2020:03:07 16:18:29.543+09:00Modify Date : 2020:03:07 16:18:29+09:00GPS Altitude : 14 m Above Sea LevelGPS Latitude : 35 deg 10' 16.28" NGPS Longitude : 136 deg 53' 0.60" ECircle Of Confusion : 0.003 mmField Of View : 104.3 degFocal Length : 1.5 mm (35 mm equivalent: 14.0 mm)GPS Position : 35 deg 10' 16.28" N, 136 deg 53' 0.60" EHyperfocal Distance : 0.30 mLight Value : 13.8