@@ -230,7 +230,6 @@ namespace Exiv2 {
230230 const std::string exifKey = " Raw profile type exif" ;
231231 const std::string app1Key = " Raw profile type APP1" ;
232232 const std::string iptcKey = " Raw profile type iptc" ;
233- const std::string iccKey = " icc" ;
234233 const std::string softKey = " Software" ;
235234 const std::string commKey = " Comment" ;
236235 const std::string descKey = " Description" ;
@@ -309,13 +308,12 @@ namespace Exiv2 {
309308
310309 // for XMP, ICC etc: read and format data
311310 bool bXMP = option == kpsXMP && findi (dataString,xmpKey)==0 ;
312- bool bICC = option == kpsIccProfile && findi (dataString,iccKey)==0 ;
313311 bool bExif = option == kpsRecursive &&(findi (dataString,exifKey)==0 || findi (dataString,app1Key)==0 );
314312 bool bIptc = option == kpsRecursive && findi (dataString,iptcKey)==0 ;
315313 bool bSoft = option == kpsRecursive && findi (dataString,softKey)==0 ;
316314 bool bComm = option == kpsRecursive && findi (dataString,commKey)==0 ;
317315 bool bDesc = option == kpsRecursive && findi (dataString,descKey)==0 ;
318- bool bDump = bXMP || bICC || bExif || bIptc || bSoft || bComm || bDesc || eXIf ;
316+ bool bDump = bXMP || bExif || bIptc || bSoft || bComm || bDesc || iCCP || eXIf ;
319317
320318 if ( bDump ) {
321319 DataBuf dataBuf;
@@ -379,7 +377,7 @@ namespace Exiv2 {
379377 bLF=true ;
380378 }
381379
382- if ( bICC || bComm ) {
380+ if ( ( iCCP && option == kpsIccProfile ) || bComm ) {
383381 out.write ((const char *) dataBuf.pData_ ,dataBuf.size_ );
384382 bLF = bComm ;
385383 }
@@ -389,6 +387,7 @@ namespace Exiv2 {
389387 out.write ((const char *)decoded.pData_ ,decoded.size_ );
390388 bLF = true ;
391389 }
390+
392391 if ( eXIf && option == kpsRecursive ) {
393392 // create memio object with the data, then print the structure
394393 BasicIo::AutoPtr p = BasicIo::AutoPtr (new MemIo (data.pData_ , dataOffset));
@@ -591,9 +590,14 @@ namespace Exiv2 {
591590 throw Error (kerImageWriteFailed);
592591 return ;
593592 }
594- else if ( !strcmp (szChunk, " eXIf" ) ) {
595- ; // do nothing Exif metdata is written following IHDR
596- ; // as zTXt chunk with signature Raw profile type exif__
593+ else if ( !strcmp (szChunk, " eXIf" ) || !strcmp (szChunk, " iCCP" ) ) {
594+ // do nothing (strip): Exif metadata is written following IHDR
595+ // as zTXt chunk with signature "Raw profile type exif",
596+ // together with the ICC profile as a fresh iCCP chunk
597+ #ifdef EXIV2_DEBUG_MESSAGES
598+ std::cout << " Exiv2::PngImage::doWriteMetadata: strip " << szChunk
599+ << " chunk (length: " << dataOffset << " )" << std::endl;
600+ #endif
597601 }
598602 else if ( !strcmp (szChunk, " IHDR" ) )
599603 {
@@ -699,17 +703,14 @@ namespace Exiv2 {
699703 }
700704 else if (!strcmp (szChunk, " tEXt" ) ||
701705 !strcmp (szChunk, " zTXt" ) ||
702- !strcmp (szChunk, " iTXt" ) ||
703- !strcmp (szChunk, " iCCP" ))
706+ !strcmp (szChunk, " iTXt" ))
704707 {
705708 DataBuf key = PngChunk::keyTXTChunk (chunkBuf, true );
706709 if (compare (" Raw profile type exif" , key, 21 ) ||
707710 compare (" Raw profile type APP1" , key, 21 ) ||
708711 compare (" Raw profile type iptc" , key, 21 ) ||
709712 compare (" Raw profile type xmp" , key, 20 ) ||
710713 compare (" XML:com.adobe.xmp" , key, 17 ) ||
711- compare (" icc" , key, 3 ) || // see test/data/imagemagick.png
712- compare (" ICC" , key, 3 ) ||
713714 compare (" Description" , key, 11 ))
714715 {
715716#ifdef EXIV2_DEBUG_MESSAGES
0 commit comments