How to remove icc profile from avif files?

Started by bat999, July 09, 2021, 08:27:51 PM

Previous topic - Next topic

bat999

Hi
Please can somebody demonstrate how to remove the icc profile from an avif file.
I use this command with jpg files...
~ $ exiftool -ICC_Profile= filename.jpg
And it does the job.

But when I use it with avif files it tells me that it has done the job...
~ $ exiftool -ICC_Profile= filename.avif
Warning: ICC_Profile deleted. Image colors may be affected - filename.avif
    0 image files updated
    1 image files unchanged

But the icc profile is still there.

With avifenc from here --> https://github.com/AOMediaCodec/libavif
there is an option "--ignore-icc" to prevent it being carried across when transcoding from jpg/png.

But it would be useful to be able to delete icc profiles from avif files instead of having to transcode again.

The filename.avif is in the zip attachment "filename_avif.zip".


~ $ exiftool -a -u -g1 filename.avif
---- ExifTool ----
ExifTool Version Number         : 12.28
---- System ----
File Name                       : filename.avif
Directory                       : .
File Size                       : 36 KiB
File Modification Date/Time     : 2021:07:10 00:27:33+01:00
File Access Date/Time           : 2021:07:10 00:27:46+01:00
File Inode Change Date/Time     : 2021:07:10 00:27:33+01:00
File Permissions                : -rw-r--r--
---- File ----
File Type                       : AVIF
File Type Extension             : avif
MIME Type                       : image/avif
Image Width                     : 620
Image Height                    : 372
---- QuickTime ----
Major Brand                     : AV1 Image File Format (.AVIF)
Minor Version                   : 0.0.0
Compatible Brands               : avif, mif1, miaf, MA1B
Handler Type                    : Picture
Handler Description             : libavif
Image Spatial Extent            : 620x372
Image Pixel Depth               : 8 8 8
AV1 Configuration Version       : 1
Seq Profile                     : 0
Seq Level Idx 0                 : 1
Seq Tier 0                      : 0
High Bit Depth                  : 0
Twelve Bit                      : 0
Chroma Format                   : YUV 4:2:0
Chroma Sample Position          : Unknown
Initial Delay Samples           : 1
Color Representation            : nclx 2 2 6
Media Data Size                 : 36481
Media Data Offset               : 819
Media Data                      : (Binary data 36481 bytes, use -b option to extract)
---- Meta ----
Primary Item Reference          : 1
---- ICC-header ----
Profile CMM Type                : Little CMS
Profile Version                 : 2.1.0
Profile Class                   : Display Device Profile
Color Space Data                : RGB
Profile Connection Space        : XYZ
Profile Date Time               : 2012:01:25 03:41:57
Profile File Signature          : acsp
Primary Platform                : Apple Computer Inc.
CMM Flags                       : Not Embedded, Independent
Device Manufacturer             :
Device Model                    :
Device Attributes               : Reflective, Glossy, Positive, Color
Rendering Intent                : Perceptual
Connection Space Illuminant     : 0.9642 1 0.82491
Profile Creator                 : Little CMS
Profile ID                      : 0
---- ICC_Profile ----
Profile Description             : c2
Profile Copyright               : FB
Media White Point               : 0.9642 1 0.82491
Media Black Point               : 0.01205 0.0125 0.01031
Red Matrix Column               : 0.43607 0.22249 0.01392
Green Matrix Column             : 0.38515 0.71687 0.09708
Blue Matrix Column              : 0.14307 0.06061 0.7141
Red Tone Reproduction Curve     : (Binary data 64 bytes, use -b option to extract)
Green Tone Reproduction Curve   : (Binary data 64 bytes, use -b option to extract)
Blue Tone Reproduction Curve    : (Binary data 64 bytes, use -b option to extract)
---- Composite ----
Image Size                      : 620x372
Megapixels                      : 0.231

bat999

Hi
The same thing seems to apply to heic files too.
exiftool -ICC_Profile= filename.heic
and
exiftool -all= filename.heic
The icc profile remains.

Am I doing something wrong?

The filename.heic is in the zip attachment "filename_heic.zip".

~ $ exiftool -a -u -g1 filename.heic
---- ExifTool ----
ExifTool Version Number         : 12.28
---- System ----
File Name                       : filename.heic
Directory                       : .
File Size                       : 16 KiB
File Modification Date/Time     : 2021:06:23 19:18:21+01:00
File Access Date/Time           : 2021:07:10 13:31:18+01:00
File Inode Change Date/Time     : 2021:07:10 13:31:18+01:00
File Permissions                : -rw-r--r--
---- File ----
File Type                       : HEIC
File Type Extension             : heic
MIME Type                       : image/heic
Image Width                     : 324
Image Height                    : 400
---- QuickTime ----
Major Brand                     : High Efficiency Image Format HEVC still image (.HEIC)
Minor Version                   : 0.0.0
Compatible Brands               : mif1, heic
Handler Type                    : Picture
Handler Description             : libheif (1.9.1) / x265 HEVC encoder (2.8)
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               : 63 (level 2.1)
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
Image Spatial Extent            : 324x400
HEVC Configuration Version      : 1
General Profile Space           : Conforming
General Tier Flag               : Main Tier
General Profile IDC             : Format Range Extensions
Gen Profile Compatibility Flags : Format Range Extensions
Constraint Indicator Flags      : 0 0 0 0 0 0
General Level IDC               : 63 (level 2.1)
Min Spatial Segmentation IDC    : 0
Parallelism Type                : 0
Chroma Format                   : Monochrome
Bit Depth Luma                  : 8
Bit Depth Chroma                : 8
Average Frame Rate              : 0
Constant Frame Rate             : Unknown
Num Temporal Layers             : 1
Temporal ID Nested              : Yes
Image Spatial Extent            : 324x400
Auxiliary Image Type            : urn:mpeg:hevc:2015:auxid:1
Media Data Size                 : 12108
Media Data Offset               : 3779
Media Data                      : (Binary data 12108 bytes, use -b option to extract)
---- Meta ----
Primary Item Reference          : 1
---- ICC-header ----
Profile CMM Type                : Linotronic
Profile Version                 : 2.1.0
Profile Class                   : Display Device Profile
Color Space Data                : RGB
Profile Connection Space        : XYZ
Profile Date Time               : 1998:02:09 06:49:00
Profile File Signature          : acsp
Primary Platform                : Microsoft Corporation
CMM Flags                       : Not Embedded, Independent
Device Manufacturer             : Hewlett-Packard
Device Model                    : sRGB
Device Attributes               : Reflective, Glossy, Positive, Color
Rendering Intent                : Media-Relative Colorimetric
Connection Space Illuminant     : 0.9642 1 0.82491
Profile Creator                 : Hewlett-Packard
Profile ID                      : 0
---- ICC_Profile ----
Profile Copyright               : Copyright (c) 1998 Hewlett-Packard Company
Profile Description             : sRGB IEC61966-2.1
Media White Point               : 0.95045 1 1.08905
Media Black Point               : 0 0 0
Red Matrix Column               : 0.43607 0.22249 0.01392
Green Matrix Column             : 0.38515 0.71687 0.09708
Blue Matrix Column              : 0.14307 0.06061 0.7141
Device Mfg Desc                 : IEC http://www.iec.ch
Device Model Desc               : IEC 61966-2.1 Default RGB colour space - sRGB
Viewing Cond Desc               : Reference Viewing Condition in IEC61966-2.1
Luminance                       : 76.03647 80 87.12462
Technology                      : Cathode Ray Tube Display
Red Tone Reproduction Curve     : (Binary data 2060 bytes, use -b option to extract)
Green Tone Reproduction Curve   : (Binary data 2060 bytes, use -b option to extract)
Blue Tone Reproduction Curve    : (Binary data 2060 bytes, use -b option to extract)
---- ICC-view ----
Viewing Cond Illuminant         : 19.6445 20.3718 16.8089
Viewing Cond Surround           : 3.92889 4.07439 3.36179
Viewing Cond Illuminant Type    : D50
---- ICC-meas ----
Measurement Observer            : CIE 1931
Measurement Backing             : 0 0 0
Measurement Geometry            : Unknown
Measurement Flare               : 0.999%
Measurement Illuminant          : D65
---- Composite ----
Image Size                      : 324x400
Megapixels                      : 0.130

StarGeek

You're not doing anything wrong.  Exiftool isn't removing the ICC_Profile, even though it seems that it should be supported because they both have R/W entries in the ICC column of the Supported File Types table.

This will require Phil's attention when he has time.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

bat999

#3
Quote from: StarGeek on July 10, 2021, 11:16:07 AM
This will require Phil's attention when he has time.
Ok
I'm not really interested in heic, can't even view them. Just experimenting is all.
But avif is used in the wild now.

With webp (not in icc support table) it gives definite error message, that's good.
~ $ exiftool -ICC_Profile= filename.webp
Error: Writing of WEBP files is not yet supported - filename.webp
    0 image files updated
    1 files weren't updated due to errors


EDIT
I can view heic with ImageMagick "display"...
display filename.heic

Phil Harvey

#4
Thanks for pointing this out.  I had marked all QuickTime item properties as "Permanent" to prevent them from being deleted because they currently can't be added back again.  The "deleted" message unfortunately occures upstream of this logic, so it is misleading in this case.

Do you think I should patch ExifTool to allow this to be deleted, keeping in mind that it can't be added back again?

- Phil

Edit: I just thought of an alternative.  ExifTool could write a zero-length profile instead of deleting it.  This will allow the profile to be added back in the same location later, so this solution should be fine as long as other programs will ignore a zero-length profile.  Maybe I'll try this.

...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

bat999

#5
Quote from: Phil Harvey on July 12, 2021, 07:57:08 AM
ExifTool could write a zero-length profile instead of deleting it.  This will allow the profile to be added back in the same location later,
Yes, that sounds OK.
Just "-ICC_Profile= ".

Quote from: Phil Harvey on July 12, 2021, 07:57:08 AM
... this solution should be fine as long as other programs will ignore a zero-length profile..[/i]
There is a validator test for avif files...
https://gpac.github.io/ComplianceWarden-wasm/avif.html

This is a file with ICC Profile : Present (524 bytes).
~ $ avifdec --info filename.avif
Image decoded: filename.avif
* Resolution     : 620x372
* Bit Depth      : 8
* Format         : YUV420
* Chroma Sam. Pos: 0
* Alpha          : Absent
* Range          : Full
* Color Primaries: 2
* Transfer Char. : 2
* Matrix Coeffs. : 6
* ICC Profile    : Present (524 bytes)
* XMP Metadata   : Absent (0 bytes)
* EXIF Metadata  : Absent (0 bytes)


This is a file without ICC Profile : Absent (0 bytes).
~ $ avifdec --info tester.avif
Image decoded: tester.avif
* Resolution     : 620x372
* Bit Depth      : 8
* Format         : YUV420
* Chroma Sam. Pos: 0
* Alpha          : Absent
* Range          : Full
* Color Primaries: 1
* Transfer Char. : 13
* Matrix Coeffs. : 6
* ICC Profile    : Absent (0 bytes)
* XMP Metadata   : Absent (0 bytes)
* EXIF Metadata  : Absent (0 bytes)


bat999

Hi
This is fixed now in ExifTool-12.30.
Thanks.

exiftool -ICC_Profile= filename.avif
and
exiftool -all= filename.avif


(Also works ok with filename.heic)

But this version throws up error messages for me, about installing MacOS module.
I'm using Linux.
The error messages didn't show before with ExifTool-12.28.
~ $ exiftool -all= filename.avif
Can't locate Image/ExifTool/MacOS.pm in @INC (you may need to install the Image::ExifTool::MacOS module) (@INC contains: /usr/local/bin/lib /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at (eval 9) line 2.
Can't find table Image::ExifTool::MacOS::MDItem
Can't locate Image/ExifTool/MacOS.pm in @INC (you may need to install the Image::ExifTool::MacOS module) (@INC contains: /usr/local/bin/lib /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at (eval 10) line 2.
Can't find table Image::ExifTool::MacOS::MDItem
Can't locate Image/ExifTool/MacOS.pm in @INC (you may need to install the Image::ExifTool::MacOS module) (@INC contains: /usr/local/bin/lib /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at (eval 11) line 2.
Can't find table Image::ExifTool::MacOS::MDItem
Can't locate Image/ExifTool/MacOS.pm in @INC (you may need to install the Image::ExifTool::MacOS module) (@INC contains: /usr/local/bin/lib /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at (eval 12) line 2.
Can't find table Image::ExifTool::MacOS::MDItem
Can't locate Image/ExifTool/MacOS.pm in @INC (you may need to install the Image::ExifTool::MacOS module) (@INC contains: /usr/local/bin/lib /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.22.1 /usr/local/share/perl/5.22.1 /usr/lib/x86_64-linux-gnu/perl5/5.22 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.22 /usr/share/perl/5.22 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base .) at (eval 13) line 2.
Can't find table Image::ExifTool::MacOS::XAttr
Warning: ICC_Profile deleted. Image colors may be affected - filename.avif
    1 image files updated

Phil Harvey

> tar -tzf ~/Desktop/Image-ExifTool-12.30.tar.gz | grep MacOS
Image-ExifTool-12.30/lib/Image/ExifTool/MacOS.pm
Image-ExifTool-12.30/t/MacOS.t
Image-ExifTool-12.30/t/MacOS_2.out
Image-ExifTool-12.30/t/images/MacOS.macos
Image-ExifTool-12.30/html/TagNames/MacOS.html


The file is there.  You could possibly get this error if you have other older installations hanging around on your system somewhere.  In this case, you should get a warning when you do exiftool -ver.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

bat999

"The file is there"

I uninstalled and purged and re-compiled.

It's OK.
;D

~ $ exiftool -ver
12.30


~ $ exiftool -ICC_Profile= filename.avif
Warning: ICC_Profile deleted. Image colors may be affected - filename.avif
    1 image files updated

~ $ avifdec -i filename.avif
Image decoded: filename.avif
* Resolution     : 620x372
* Bit Depth      : 8
* Format         : YUV420
* Chroma Sam. Pos: 0
* Alpha          : Absent
* Range          : Full
* Color Primaries: 2
* Transfer Char. : 2
* Matrix Coeffs. : 6
* ICC Profile    : Absent (0 bytes)
* XMP Metadata   : Absent (0 bytes)
* EXIF Metadata  : Absent (0 bytes)
* Transformations: None
* Progressive    : Unavailable
* 1 timescales per second, 1.00 seconds (1 timescales), 1 frame
* Frame:
   * Decoded frame [0] [pts 0.00 (0 timescales)] [duration 1.00 (1 timescales)] [620x372]


~ $ avifdec -i filename.avif_original
Image decoded: filename.avif_original
* Resolution     : 620x372
* Bit Depth      : 8
* Format         : YUV420
* Chroma Sam. Pos: 0
* Alpha          : Absent
* Range          : Full
* Color Primaries: 2
* Transfer Char. : 2
* Matrix Coeffs. : 6
* ICC Profile    : Present (524 bytes)
* XMP Metadata   : Absent (0 bytes)
* EXIF Metadata  : Absent (0 bytes)
* Transformations: None
* Progressive    : Unavailable
* 1 timescales per second, 1.00 seconds (1 timescales), 1 frame
* Frame:
   * Decoded frame [0] [pts 0.00 (0 timescales)] [duration 1.00 (1 timescales)] [620x372]