Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PNG: always strip the existing iCCP chunk #2254

Merged
merged 1 commit into from
Jul 1, 2022
Merged

PNG: always strip the existing iCCP chunk #2254

merged 1 commit into from
Jul 1, 2022

Conversation

kmilos
Copy link
Collaborator

@kmilos kmilos commented Jun 29, 2022

Otherwise we end up replicating iCCP chunks that have a profile whose name is not "ICC" or "icc" each time when modifying.

$ exiv2 -pS test.png
STRUCTURE OF PNG FILE: test.png
 address | chunk |  length | data                           | checksum
       8 | IHDR  |      13 | ... ...X....                   | 0x15141527
      33 | iCCP  |    8522 | sRGB..h...WT....W...6lr...s.9K | 0x4bde1684
    8567 | tEXt  |   59297 | Raw profile type exif..exif.   | 0x22b5e254
   67876 | IDAT  |    8192 | x^<.[.dKr...}....s....(<P"...R | 0x5dcd61d5
   76080 | IDAT  |    8192 | 2..IgyG..'..^nBN.:.......J.<.u | 0x3c372328
   84284 | IDAT  |    8192 | 01.Y..$>.OXbL..."9.....+UC*... | 0xdc433710
   92488 | IDAT  |    8192 | ....c..(.B...\.k^.i..P..``[..t | 0xf00a7310
   ...
$ exiv2 -M"add Xmp.dc.source XmpText foobar" test.png
$ exiv2 -pS test.png
STRUCTURE OF PNG FILE: test.png
 address | chunk |  length | data                           | checksum
       8 | IHDR  |      13 | ... ...X....                   | 0x15141527
      33 | zTXt  |   17462 | Raw profile type exif..x...k.. | 0xb88d27fa
   17507 | iCCP  |    8522 | sRGB..x...WT....W...6lr...s.9K | 0x65146da4
   26041 | iTXt  |    2407 | XML:com.adobe.xmp.....<?xpacke | 0x4f8f529c
   28460 | iCCP  |    8522 | sRGB..h...WT....W...6lr...s.9K | 0x4bde1684
   36994 | IDAT  |    8192 | x^<.[.dKr...}....s....(<P"...R | 0x5dcd61d5
   45198 | IDAT  |    8192 | 2..IgyG..'..^nBN.:.......J.<.u | 0x3c372328
   53402 | IDAT  |    8192 | 01.Y..$>.OXbL..."9.....+UC*... | 0xdc433710
   61606 | IDAT  |    8192 | ....c..(.B...\.k^.i..P..``[..t | 0xf00a7310
   ...

@kmilos kmilos force-pushed the fix_png_iccp branch 2 times, most recently from cf38bf3 to cdf32cb Compare June 30, 2022 07:11
@codecov
Copy link

codecov bot commented Jun 30, 2022

Codecov Report

Merging #2254 (c2fbff2) into main (7ebf2a1) will decrease coverage by 0.00%.
The diff coverage is 60.00%.

@@            Coverage Diff             @@
##             main    #2254      +/-   ##
==========================================
- Coverage   63.46%   63.46%   -0.01%     
==========================================
  Files         118      118              
  Lines       19612    19608       -4     
  Branches     9566     9562       -4     
==========================================
- Hits        12447    12444       -3     
  Misses       5096     5096              
+ Partials     2069     2068       -1     
Impacted Files Coverage Δ
src/pngimage.cpp 59.78% <60.00%> (-0.17%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7ebf2a1...c2fbff2. Read the comment docs.

@kmilos
Copy link
Collaborator Author

kmilos commented Jun 30, 2022

After the fix:

$ ./exiv2 -M"add Xmp.dc.source XmpText foobar" test.png
$ ./exiv2 -pS test.png                          
STRUCTURE OF PNG FILE: test.png
 address | chunk |  length | data                           | checksum
       8 | IHDR  |      13 | ... ...X....                   | 0x15141527
      33 | zTXt  |   17462 | Raw profile type exif..x...k.. | 0xb88d27fa
   17507 | iCCP  |    8522 | sRGB..x...WT....W...6lr...s.9K | 0x65146da4
   26041 | iTXt  |    2407 | XML:com.adobe.xmp.....<?xpacke | 0x4f8f529c
   28460 | IDAT  |    8192 | x^<.[.dKr...}....s....(<P"...R | 0x5dcd61d5
   36664 | IDAT  |    8192 | 2..IgyG..'..^nBN.:.......J.<.u | 0x3c372328
   44868 | IDAT  |    8192 | 01.Y..$>.OXbL..."9.....+UC*... | 0xdc433710
   53072 | IDAT  |    8192 | ....c..(.B...\.k^.i..P..``[..t | 0xf00a7310
   ...

@kmilos kmilos merged commit 8a9f6ac into main Jul 1, 2022
@kmilos kmilos deleted the fix_png_iccp branch July 1, 2022 14:47
kmilos added a commit that referenced this pull request Jul 1, 2022
@kmilos kmilos added bug imageHandler Anything related to specific ImageHandlers labels Jul 5, 2022
antermin pushed a commit to antermin/exiv2 that referenced this pull request Mar 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug imageHandler Anything related to specific ImageHandlers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants