diff --git a/include/exiv2/image.hpp b/include/exiv2/image.hpp
index a2ed2edf..09c8dcb9 100644
--- a/include/exiv2/image.hpp
+++ b/include/exiv2/image.hpp
@@ -20,16 +20,7 @@
*/
/*!
@file image.hpp
- @brief Class Image, defining the interface for all Image subclasses.
@version $Rev: 3091 $
- @author Andreas Huggel (ahu)
- ahuggel@gmx.net
- @author Brad Schick (brad)
- brad@robotbattle.com
- @date 09-Jan-04, ahu: created
- 11-Feb-04, ahu: isolated as a component
- 19-Jul-04, brad: revamped to be more flexible and support IPTC
- 15-Jan-05, brad: inside-out design changes
*/
#ifndef IMAGE_HPP_
#define IMAGE_HPP_
@@ -233,7 +224,7 @@ namespace Exiv2 {
to the image until the writeMetadata() method is called.
@param iccProfile DataBuf containing profile (binary)
*/
- virtual void setIccProfile(DataBuf& iccProfile);
+ virtual void setIccProfile(DataBuf& iccProfile,bool bTestValid=true);
/*!
@brief Erase iccProfile. the profile is not removed from
the actual image until the writeMetadata() method is called.
diff --git a/src/actions.cpp b/src/actions.cpp
index 35768e4b..ee51dd32 100644
--- a/src/actions.cpp
+++ b/src/actions.cpp
@@ -21,9 +21,6 @@
/*
File: actions.cpp
Version: $Rev$
- Author(s): Andreas Huggel (ahu)
- History: 08-Dec-03, ahu: created
- 30-Apr-06, Roger Larsson: Print filename if processing multiple files
*/
// *****************************************************************************
#include "rcsid_int.hpp"
@@ -1175,25 +1172,32 @@ namespace Action {
int Extract::writeIccProfile() const
{
+ int rc = 0;
if (!Exiv2::fileExists(path_, true)) {
std::cerr << path_
<< ": " << _("Failed to open the file\n");
- return -1;
+ rc = -1;
}
- Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path_);
- assert(image.get() != 0);
- image->readMetadata();
- std::string iccPath = newFilePath(path_,".icc");
- if (Params::instance().verbose_) {
- std::cout << _("Writing iccProfile: ") << iccPath << std::endl;
+ if ( rc == 0 ) {
+ Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open(path_);
+ assert(image.get() != 0);
+ image->readMetadata();
+ if ( !image->iccProfileDefined() ) {
+ std::cerr << _("No embedded iccProfile: ") << path_ << std::endl;
+ rc = -2;
+ } else {
+ std::string iccPath = newFilePath(path_,".icc");
+ if (Params::instance().verbose_) {
+ std::cout << _("Writing iccProfile: ") << iccPath << std::endl;
+ }
+ Exiv2::FileIo iccFile(iccPath);
+ iccFile.open("wb") ;
+ iccFile.write(image->iccProfile()->pData_,image->iccProfile()->size_);
+ iccFile.close();
+ }
}
- Exiv2::FileIo iccFile(iccPath);
- iccFile.open("wb") ;
- iccFile.write(image->iccProfile()->pData_,image->iccProfile()->size_);
- iccFile.close();
-
- return 0;
+ return rc;
} // Extract::writeIccProfile
@@ -1330,9 +1334,9 @@ namespace Action {
<< ": " << _("Failed to open the file\n");
rc = -1;
} else {
- Exiv2::DataBuf iccProfileBlob = Exiv2::readFile(iccProfilePath);
- rc = insertIccProfile(path,iccProfileBlob);
- }
+ Exiv2::DataBuf iccProfileBlob = Exiv2::readFile(iccProfilePath);
+ rc = insertIccProfile(path,iccProfileBlob);
+ }
return rc;
} // Insert::insertIccProfile
diff --git a/src/error.cpp b/src/error.cpp
index b7472b78..d92ea7f4 100644
--- a/src/error.cpp
+++ b/src/error.cpp
@@ -21,8 +21,6 @@
/*
File: error.cpp
Version: $Rev$
- Author(s): Andreas Huggel (ahu)
- History: 02-Apr-05, ahu: created
*/
// *****************************************************************************
#include "rcsid_int.hpp"
@@ -105,7 +103,8 @@ namespace {
{ 49, N_("TIFF directory %1 has too many entries") }, // %1=TIFF directory name
{ 50, N_("Multiple TIFF array element tags %1 in one directory") }, // %1=tag number
{ 51, N_("TIFF array element tag %1 has wrong type") }, // %1=tag number
- { 52, N_("%1 has invalid XMP value type `%2'") } // %1=key, %2=value type
+ { 52, N_("%1 has invalid XMP value type `%2'") }, // %1=key, %2=value type
+ { 53, N_("Not a valid ICC Profile") },
};
}
diff --git a/src/image.cpp b/src/image.cpp
index 6fc0e4aa..d396c7ad 100644
--- a/src/image.cpp
+++ b/src/image.cpp
@@ -21,12 +21,6 @@
/*
File: image.cpp
Version: $Rev$
- Author(s): Andreas Huggel (ahu)
- Brad Schick (brad)
- History: 26-Jan-04, ahu: created
- 11-Feb-04, ahu: isolated as a component
- 19-Jul-04, brad: revamped to be more flexible and support Iptc
- 15-Jan-05, brad: inside-out design changes
*/
// *****************************************************************************
#include "rcsid_int.hpp"
@@ -289,8 +283,12 @@ namespace Exiv2 {
comment_ = comment;
}
- void Image::setIccProfile(Exiv2::DataBuf& iccProfile)
+ void Image::setIccProfile(Exiv2::DataBuf& iccProfile,bool bTestValid)
{
+ if ( bTestValid ) {
+ long size = iccProfile.pData_ ? getULong(iccProfile.pData_, bigEndian): -1;
+ if ( size!= iccProfile.size_ ) throw Error(53);
+ }
iccProfile_ = iccProfile;
}
diff --git a/src/jpgimage.cpp b/src/jpgimage.cpp
index 4e34869c..be7de856 100644
--- a/src/jpgimage.cpp
+++ b/src/jpgimage.cpp
@@ -21,11 +21,6 @@
/*
File: jpgimage.cpp
Version: $Rev$
- Author(s): Andreas Huggel (ahu)
- Brad Schick (brad)
- Volker Grabsch (vog)
- Michael Ulbrich (mul)
- History: 15-Jan-05, brad: split out from image.cpp
*/
// *****************************************************************************
#include "rcsid_int.hpp"
@@ -105,12 +100,12 @@ namespace Exiv2 {
static inline bool inRange(int lo,int value, int hi)
{
- return lo<=value && value <= hi;
+ return lo<=value && value <= hi;
}
static inline bool inRange2(int value,int lo1,int hi1, int lo2,int hi2)
{
- return inRange(lo1,value,hi1) || inRange(lo2,value,hi2);
+ return inRange(lo1,value,hi1) || inRange(lo2,value,hi2);
}
bool Photoshop::isIrb(const byte* pPsData,
@@ -463,34 +458,41 @@ namespace Exiv2 {
--search;
}
else if ( marker == app2_ && memcmp(buf.pData_ + 2, iccId_,11)==0) {
- // ICC profile
- if ( ! foundIccData ) {
- foundIccData = true ;
- --search ;
- }
-
+ // ICC profile
+ if ( ! foundIccData ) {
+ foundIccData = true ;
+ --search ;
+ }
+ int chunk = (int) buf.pData_[2+12];
+ int chunks = (int) buf.pData_[2+13];
#ifdef DEBUG
- int chunk = (int) buf.pData_[2+12];
- int chunks = (int) buf.pData_[2+13];
- std::cerr << "Found ICC Profile chunk " << chunk <<" of "<< chunks << "\n";
+ // ICC1v43_2010-12.pdf header is 14 bytes
+ // header = "ICC_PROFILE\0" (12 bytes)
+ // chunk/chunks are a single byte
+ // Spec 7.2 Profile bytes 0-3 size
+ uint32_t s = getULong(buf.pData_ + (2+14) , bigEndian);
+ std::cerr << "Found ICC Profile chunk " << chunk
+ << " of " << chunks
+ << (chunk==1 ? " size: " : "" ) << (chunk==1 ? s : 0)
+ << std::endl ;
#endif
- io_->seek(-bufRead , BasicIo::cur); // back up to start of buffer (after marker)
- io_->seek( 16+2 , BasicIo::cur); // step size + header
- // read in profile
- DataBuf icc(size-2-16) ;
- io_->read( icc.pData_,icc.size_);
-
- if ( iccProfile_.size_ > 0 ) { // first block of profile
- setIccProfile(icc);
- } else { // extend existing profile
- DataBuf profile(iccProfile_.size_+icc.size_);
- if ( iccProfile_.size_ ) {
- ::memcpy(profile.pData_,iccProfile_.pData_,iccProfile_.size_);
- }
- ::memcpy(profile.pData_+iccProfile_.size_,icc.pData_,icc.size_);
- setIccProfile(profile);
- }
+ io_->seek(-bufRead, BasicIo::cur); // back up to start of buffer (after marker)
+ io_->seek( 14+2, BasicIo::cur); // step header
+ // read in profile
+ DataBuf icc(size-2-14) ;
+ io_->read( icc.pData_,icc.size_);
+
+ if ( !iccProfileDefined() ) { // first block of profile
+ setIccProfile(icc,chunk==chunks);
+ } else { // extend existing profile
+ DataBuf profile(iccProfile_.size_+icc.size_);
+ if ( iccProfile_.size_ ) {
+ ::memcpy(profile.pData_,iccProfile_.pData_,iccProfile_.size_);
+ }
+ ::memcpy(profile.pData_+iccProfile_.size_,icc.pData_,icc.size_);
+ setIccProfile(profile,chunk==chunks);
+ }
}
else if ( pixelHeight_ == 0 && inRange2(marker,sof0_,sof3_,sof5_,sof15_) ) {
// We hit a SOFn (start-of-frame) marker
@@ -689,11 +691,14 @@ namespace Exiv2 {
} else if ( option == kpsIccProfile && std::strcmp(signature,iccId_) == 0 ) {
// extract ICCProfile
if ( size > 0 ) {
- io_->seek(-bufRead , BasicIo::cur); // back to buffer (after marker+size)
- io_->seek( 16 , BasicIo::cur); // step over header
- DataBuf icc(size-2-16);
+ io_->seek(-bufRead, BasicIo::cur); // back to buffer (after marker)
+ io_->seek( 14+2, BasicIo::cur); // step over header
+ DataBuf icc(size-(14+2));
io_->read( icc.pData_,icc.size_);
out.write((const char*)icc.pData_,icc.size_);
+#ifdef DEBUG
+ std::cout << "iccProfile size = " << icc.size_ << std::endl;
+#endif
bufRead = size;
}
} else if ( option == kpsIptcErase && std::strcmp(signature,"Photoshop 3.0") == 0 ) {
@@ -777,8 +782,8 @@ namespace Exiv2 {
// print COM marker
if ( bPrint && marker == com_ ) {
- int n = (size-2)>32?32:size-2; // size includes 2 for the two bytes for size!
- out << "| " << Internal::binaryToString(buf,n,2); // start after the two bytes
+ int n = (size-2)>32?32:size-2; // size includes 2 for the two bytes for size!
+ out << "| " << Internal::binaryToString(buf,n,2); // start after the two bytes
}
// Skip the segment if the size is known
@@ -792,7 +797,7 @@ namespace Exiv2 {
REPORT_MARKER;
}
done = marker == eoi_ || marker == sos_;
- if ( done ) out << std::endl;
+ if ( done && bPrint ) out << std::endl;
}
}
if ( option == kpsIptcErase && iptcDataSegs.size() ) {
@@ -940,8 +945,8 @@ namespace Exiv2 {
if (size < 31) throw Error(22);
skipApp2Icc.push_back(count);
if ( !foundIccData ) {
- ++search;
- foundIccData = true ;
+ ++search;
+ foundIccData = true ;
}
if (io_->seek(size-bufRead, BasicIo::cur)) throw Error(22);
}
@@ -1084,12 +1089,13 @@ namespace Exiv2 {
--search;
}
- if (iccProfile_.size_ > 0) {
+ if (iccProfileDefined()) {
// Write APP2 marker, size of APP2 field, and IccProfile
+ // See comments in readMetadata() about the ICC embedding specification
tmpBuf[0] = 0xff;
tmpBuf[1] = app2_;
- int chunk_size = 256*256-40 ; // leave bytes for marker and header
+ int chunk_size = 256*256-40 ; // leave bytes for marker, header and padding
int size = (int) iccProfile_.size_ ;
int chunks = 1 + (size-1) / chunk_size ;
if (iccProfile_.size_ > 256*chunk_size) throw Error(37, "IccProfile");
@@ -1100,20 +1106,19 @@ namespace Exiv2 {
// write JPEG marker (2 bytes)
if (outIo.write(tmpBuf, 2) != 2) throw Error(21); // JPEG Marker
// write length (2 bytes). length includes the 2 bytes for the length
- us2Data(tmpBuf + 2, 2+16+bytes, bigEndian);
+ us2Data(tmpBuf + 2, 2+14+bytes, bigEndian);
if (outIo.write(tmpBuf+2, 2) != 2) throw Error(21); // JPEG Length
- // write the ICC_PROFILE header (16 bytes)
- char pad[4];
+ // write the ICC_PROFILE header (14 bytes)
+ char pad[2];
pad[0] = chunk+1;
pad[1] = chunks;
- pad[2] = 0;
- pad[3] = 0;
outIo.write((const byte *) iccId_,12);
- outIo.write((const byte *) pad, 4);
+ outIo.write((const byte *) pad, 1);
if (outIo.write(iccProfile_.pData_+ (chunk*chunk_size), bytes) != bytes)
throw Error(21);
if (outIo.error()) throw Error(21);
+ outIo.write((const byte *)pad+2,2); // couple of padding bytes
}
--search;
}
diff --git a/src/tiffimage.cpp b/src/tiffimage.cpp
index 7184ec35..5120b353 100644
--- a/src/tiffimage.cpp
+++ b/src/tiffimage.cpp
@@ -21,9 +21,6 @@
/*
File: tiffimage.cpp
Version: $Rev$
- Author(s): Andreas Huggel (ahu)
- History: 15-Mar-06, ahu: created
-
*/
// *****************************************************************************
#include "rcsid_int.hpp"
@@ -194,12 +191,12 @@ namespace Exiv2 {
setByteOrder(bo);
// read profile from the metadata
- Exiv2::ExifKey key("Exif.Image.InterColorProfile");
- Exiv2::ExifData::iterator pos = exifData_.findKey(key);
- if ( pos != exifData_.end() ) {
- iccProfile_.alloc(pos->count());
- pos->copy(iccProfile_.pData_,bo);
- }
+ Exiv2::ExifKey key("Exif.Image.InterColorProfile");
+ Exiv2::ExifData::iterator pos = exifData_.findKey(key);
+ if ( pos != exifData_.end() ) {
+ iccProfile_.alloc(pos->count());
+ pos->copy(iccProfile_.pData_,bo);
+ }
} // TiffImage::readMetadata
@@ -229,16 +226,16 @@ namespace Exiv2 {
setByteOrder(bo);
// fixup ICC profile
- Exiv2::ExifKey key("Exif.Image.InterColorProfile");
- Exiv2::ExifData::iterator pos = exifData_.findKey(key);
- bool found = pos != exifData_.end();
- if ( iccProfile_.size_ > 0 ) {
- Exiv2::DataValue value(iccProfile_.pData_,iccProfile_.size_);
- if ( found ) pos->setValue(&value);
- else exifData_.add(key,&value);
- } else {
- if ( found ) exifData_.erase(pos);
- }
+ Exiv2::ExifKey key("Exif.Image.InterColorProfile");
+ Exiv2::ExifData::iterator pos = exifData_.findKey(key);
+ bool found = pos != exifData_.end();
+ if ( iccProfile_.size_ > 0 ) {
+ Exiv2::DataValue value(iccProfile_.pData_,iccProfile_.size_);
+ if ( found ) pos->setValue(&value);
+ else exifData_.add(key,&value);
+ } else {
+ if ( found ) exifData_.erase(pos);
+ }
TiffParser::encode(*io_, pData, size, bo, exifData_, iptcData_, xmpData_); // may throw
} // TiffImage::writeMetadata
@@ -615,7 +612,7 @@ namespace Exiv2 {
io.read(bytes,jump ) ; // read
bytes[jump]=0 ;
if ( ::strcmp("Nikon",chars) == 0 ) {
- // tag is an embedded tiff
+ // tag is an embedded tiff
byte* bytes=new byte[count-jump] ; // allocate memory
io.read(bytes,count-jump) ; // read
MemIo memIo(bytes,count-jump) ; // create a file
@@ -632,7 +629,7 @@ namespace Exiv2 {
out << (char*) buf.pData_;
}
if ( isPrintICC(tag,option) ) {
- out.write((const char*)buf.pData_,buf.size_);
+ out.write((const char*)buf.pData_,kount);
}
}
io.read(dir.pData_, 4);
@@ -2525,7 +2522,7 @@ namespace Exiv2 {
{ 0x0214, ifd0Id }, // Exif.Image.ReferenceBlackWhite
{ 0x828d, ifd0Id }, // Exif.Image.CFARepeatPatternDim
{ 0x828e, ifd0Id }, // Exif.Image.CFAPattern
- // { 0x8773, ifd0Id }, // Exif.Image.InterColorProfile
+ // { 0x8773, ifd0Id }, // Exif.Image.InterColorProfile
{ 0x8824, ifd0Id }, // Exif.Image.SpectralSensitivity
{ 0x8828, ifd0Id }, // Exif.Image.OECF
{ 0x9102, ifd0Id }, // Exif.Image.CompressedBitsPerPixel
diff --git a/test/data/Reagan.jpg b/test/data/Reagan.jpg
index 69fe7589..50d012f2 100644
Binary files a/test/data/Reagan.jpg and b/test/data/Reagan.jpg differ
diff --git a/test/data/ReaganLargeJpg.jpg b/test/data/ReaganLargeJpg.jpg
new file mode 100644
index 00000000..b742529c
Binary files /dev/null and b/test/data/ReaganLargeJpg.jpg differ
diff --git a/test/data/ReaganLarge.png b/test/data/ReaganLargePng.png
similarity index 100%
rename from test/data/ReaganLarge.png
rename to test/data/ReaganLargePng.png
diff --git a/test/data/ReaganLarge.tiff b/test/data/ReaganLargeTiff.tiff
similarity index 100%
rename from test/data/ReaganLarge.tiff
rename to test/data/ReaganLargeTiff.tiff
diff --git a/test/data/bugfixes-test.out b/test/data/bugfixes-test.out
index df6277e8..30b283c8 100644
Binary files a/test/data/bugfixes-test.out and b/test/data/bugfixes-test.out differ
diff --git a/test/data/icc-test.out b/test/data/icc-test.out
index 7f2e9901..78ab1b63 100644
--- a/test/data/icc-test.out
+++ b/test/data/icc-test.out
@@ -1,162 +1,275 @@
STRUCTURE OF JPEG FILE: Reagan.jpg
address | marker | length | data
0 | 0xffd8 SOI
- 2 | 0xffe0 APP0 | 16 | JFIF.....,.,....
- 20 | 0xffe1 APP1 | 5671 | Exif..MM.*......................
- 5693 | 0xffed APP13 | 9594 | Photoshop 3.0.8BIM..........Z...
- 15289 | 0xffe1 APP1 | 7062 | http://ns.adobe.com/xap/1.0/.J... chunk 12/25
- 798898 | 0xffe2 APP2 | 65514 | ICC_PROFILE......X..up.......... chunk 13/25
- 864414 | 0xffe2 APP2 | 65514 | ICC_PROFILE..........<.......... chunk 14/25
- 929930 | 0xffe2 APP2 | 65514 | ICC_PROFILE................,...' chunk 15/25
- 995446 | 0xffe2 APP2 | 65514 | ICC_PROFILE.........g.....m%... chunk 16/25
- 1060962 | 0xffe2 APP2 | 65514 | ICC_PROFILE........s....xX.M..n. chunk 17/25
- 1126478 | 0xffe2 APP2 | 65514 | ICC_PROFILE..............0...... chunk 18/25
- 1191994 | 0xffe2 APP2 | 65514 | ICC_PROFILE..........(.n.B...... chunk 19/25
- 1257510 | 0xffe2 APP2 | 65514 | ICC_PROFILE.....0.0.282.0.282.0. chunk 20/25
- 1323026 | 0xffe2 APP2 | 65514 | ICC_PROFILE.....175.0.176.0.175. chunk 21/25
- 1388542 | 0xffe2 APP2 | 65514 | ICC_PROFILE.....103.0.114.0.126. chunk 22/25
- 1454058 | 0xffe2 APP2 | 65514 | ICC_PROFILE.....6.0.049.0.053.0. chunk 23/25
- 1519574 | 0xffe2 APP2 | 65514 | ICC_PROFILE......0.670.0.653.0.6 chunk 24/25
- 1585090 | 0xffe2 APP2 | 41714 | ICC_PROFILE.....09.0.584.0.555.0 chunk 25/25
- 1626806 | 0xffed APP13 | 9594 | Photoshop 3.0.8BIM..........Z...
- 1636402 | 0xffee APP14 | 14 | Adobe.d@......
- 1636418 | 0xffdb DQT | 132
- 1636552 | 0xffc0 SOF0 | 17
- 1636571 | 0xffdd DRI | 4
- 1636577 | 0xffc4 DHT | 418
- 1636997 | 0xffda SOS
+ 2 | 0xffe1 APP1 | 5704 | Exif..MM.*......................
+ 5708 | 0xffe1 APP1 | 5287 | http://ns.adobe.com/xap/1.0/.J...a.` chunk 12/69
+ 797177 | 0xffe2 APP2 | 65512 | ICC_PROFILE...X..up............. chunk 13/-84
+ 862692 | 0xffe2 APP2 | 65512 | ICC_PROFILE.......<............. chunk 14/-32
+ 928207 | 0xffe2 APP2 | 65512 | ICC_PROFILE.............,...'... chunk 15/-1
+ 993722 | 0xffe2 APP2 | 65512 | ICC_PROFILE......g.....m%....qw. chunk 16/-1
+ 1059237 | 0xffe2 APP2 | 65512 | ICC_PROFILE.....s....xX.M..n.... chunk 17/-1
+ 1124752 | 0xffe2 APP2 | 65512 | ICC_PROFILE...........0......E.. chunk 18/-1
+ 1190267 | 0xffe2 APP2 | 65512 | ICC_PROFILE.......(.n.B......... chunk 19/-1
+ 1255782 | 0xffe2 APP2 | 65512 | ICC_PROFILE..0.0.282.0.282.0.281 chunk 20/48
+ 1321297 | 0xffe2 APP2 | 65512 | ICC_PROFILE..175.0.176.0.175.0.1 chunk 21/49
+ 1386812 | 0xffe2 APP2 | 65512 | ICC_PROFILE..103.0.114.0.126.0.1 chunk 22/49
+ 1452327 | 0xffe2 APP2 | 65512 | ICC_PROFILE..6.0.049.0.053.0.059 chunk 23/54
+ 1517842 | 0xffe2 APP2 | 65512 | ICC_PROFILE...0.670.0.653.0.634. chunk 24/9
+ 1583357 | 0xffe2 APP2 | 41712 | ICC_PROFILE..09.0.584.0.555.0.50 chunk 25/48
+ 1625072 | 0xffed APP13 | 3030 | Photoshop 3.0.8BIM..........Z...
+ 1628104 | 0xffee APP14 | 14 | Adobe.d@......
+ 1628120 | 0xffdb DQT | 132
+ 1628254 | 0xffc0 SOF0 | 17
+ 1628273 | 0xffdd DRI | 4
+ 1628279 | 0xffc4 DHT | 418
+ 1628699 | 0xffda SOS
STRUCTURE OF JPEG FILE: Reagan.jpg
address | marker | length | data
0 | 0xffd8 SOI
- 2 | 0xffe0 APP0 | 16 | JFIF.....,.,....
- 20 | 0xffe1 APP1 | 5658 | Exif..MM.*......................
- 5680 | 0xffe1 APP1 | 7024 | http://ns.adobe.com/xap/1.0/.J...a.`1 chunk 12/-81
+ 797177 | 0xffe2 APP2 | 65512 | ICC_PROFILE..X..up.............. chunk 13/88
+ 862692 | 0xffe2 APP2 | 65512 | ICC_PROFILE......<.............. chunk 14/-76
+ 928207 | 0xffe2 APP2 | 65512 | ICC_PROFILE............,...'.... chunk 15/-1
+ 993722 | 0xffe2 APP2 | 65512 | ICC_PROFILE.....g.....m%....qw.. chunk 16/-1
+ 1059237 | 0xffe2 APP2 | 65512 | ICC_PROFILE....s....xX.M..n..... chunk 17/-1
+ 1124752 | 0xffe2 APP2 | 65512 | ICC_PROFILE..........0......E... chunk 18/-1
+ 1190267 | 0xffe2 APP2 | 65512 | ICC_PROFILE......(.n.B.........J chunk 19/-1
+ 1255782 | 0xffe2 APP2 | 65512 | ICC_PROFILE...0.282.0.282.0.281. chunk 20/9
+ 1321297 | 0xffe2 APP2 | 65512 | ICC_PROFILE..75.0.176.0.175.0.17 chunk 21/55
+ 1386812 | 0xffe2 APP2 | 65512 | ICC_PROFILE..03.0.114.0.126.0.13 chunk 22/48
+ 1452327 | 0xffe2 APP2 | 65512 | ICC_PROFILE...0.049.0.053.0.059. chunk 23/9
+ 1517842 | 0xffe2 APP2 | 65512 | ICC_PROFILE..0.670.0.653.0.634.0 chunk 24/48
+ 1583357 | 0xffe2 APP2 | 41712 | ICC_PROFILE..9.0.584.0.555.0.509 chunk 25/57
+ 1625072 | 0xffed APP13 | 3030 | Photoshop 3.0.8BIM..........Z...
+ 1628104 | 0xffee APP14 | 14 | Adobe.d@......
+ 1628120 | 0xffdb DQT | 132
+ 1628254 | 0xfffe COM | 10 | abcdefg
+ 1628266 | 0xffc0 SOF0 | 17
+ 1628285 | 0xffdd DRI | 4
+ 1628291 | 0xffc4 DHT | 418
+ 1628711 | 0xffda SOS
abcdefg
STRUCTURE OF JPEG FILE: Reagan.jpg
address | marker | length | data
0 | 0xffd8 SOI
- 2 | 0xffe0 APP0 | 16 | JFIF.....,.,....
- 20 | 0xffe1 APP1 | 5658 | Exif..MM.*......................
- 5680 | 0xffe1 APP1 | 7024 | http://ns.adobe.com/xap/1.0/.J...a.`1 chunk 12/59
+ 797177 | 0xffe2 APP2 | 65512 | ICC_PROFILE....up............... chunk 13/-1
+ 862692 | 0xffe2 APP2 | 65512 | ICC_PROFILE.....<............... chunk 14/-1
+ 928207 | 0xffe2 APP2 | 65512 | ICC_PROFILE...........,...'..... chunk 15/-96
+ 993722 | 0xffe2 APP2 | 65512 | ICC_PROFILE....g.....m%....qw.. chunk 16/0
+ 1059237 | 0xffe2 APP2 | 65512 | ICC_PROFILE...s....xX.M..n.....g chunk 17/-126
+ 1124752 | 0xffe2 APP2 | 65512 | ICC_PROFILE.........0......E.... chunk 18/22
+ 1190267 | 0xffe2 APP2 | 65512 | ICC_PROFILE.....(.n.B.........J} chunk 19/-1
+ 1255782 | 0xffe2 APP2 | 65512 | ICC_PROFILE..0.282.0.282.0.281.0 chunk 20/48
+ 1321297 | 0xffe2 APP2 | 65512 | ICC_PROFILE..5.0.176.0.175.0.174 chunk 21/53
+ 1386812 | 0xffe2 APP2 | 65512 | ICC_PROFILE..3.0.114.0.126.0.136 chunk 22/51
+ 1452327 | 0xffe2 APP2 | 65512 | ICC_PROFILE..0.049.0.053.0.059.0 chunk 23/48
+ 1517842 | 0xffe2 APP2 | 65512 | ICC_PROFILE...670.0.653.0.634.0. chunk 24/46
+ 1583357 | 0xffe2 APP2 | 41712 | ICC_PROFILE...0.584.0.555.0.509. chunk 25/9
+ 1625072 | 0xffed APP13 | 3030 | Photoshop 3.0.8BIM..........Z...
+ 1628104 | 0xffee APP14 | 14 | Adobe.d@......
+ 1628120 | 0xffdb DQT | 132
+ 1628254 | 0xffc0 SOF0 | 17
+ 1628273 | 0xffdd DRI | 4
+ 1628279 | 0xffc4 DHT | 418
+ 1628699 | 0xffda SOS
+Exiv2 exception in insert action for file Reagan.jpg:
+Not a valid ICC Profile
STRUCTURE OF JPEG FILE: Reagan.jpg
address | marker | length | data
0 | 0xffd8 SOI
- 2 | 0xffe0 APP0 | 16 | JFIF.....,.,....
- 20 | 0xffe1 APP1 | 5658 | Exif..MM.*......................
- 5680 | 0xffe1 APP1 | 7024 | http://ns.adobe.com/xap/1.0/.J...a.`1 chunk 12/59
+ 797177 | 0xffe2 APP2 | 65512 | ICC_PROFILE....up............... chunk 13/-1
+ 862692 | 0xffe2 APP2 | 65512 | ICC_PROFILE.....<............... chunk 14/-1
+ 928207 | 0xffe2 APP2 | 65512 | ICC_PROFILE...........,...'..... chunk 15/-96
+ 993722 | 0xffe2 APP2 | 65512 | ICC_PROFILE....g.....m%....qw.. chunk 16/0
+ 1059237 | 0xffe2 APP2 | 65512 | ICC_PROFILE...s....xX.M..n.....g chunk 17/-126
+ 1124752 | 0xffe2 APP2 | 65512 | ICC_PROFILE.........0......E.... chunk 18/22
+ 1190267 | 0xffe2 APP2 | 65512 | ICC_PROFILE.....(.n.B.........J} chunk 19/-1
+ 1255782 | 0xffe2 APP2 | 65512 | ICC_PROFILE..0.282.0.282.0.281.0 chunk 20/48
+ 1321297 | 0xffe2 APP2 | 65512 | ICC_PROFILE..5.0.176.0.175.0.174 chunk 21/53
+ 1386812 | 0xffe2 APP2 | 65512 | ICC_PROFILE..3.0.114.0.126.0.136 chunk 22/51
+ 1452327 | 0xffe2 APP2 | 65512 | ICC_PROFILE..0.049.0.053.0.059.0 chunk 23/48
+ 1517842 | 0xffe2 APP2 | 65512 | ICC_PROFILE...670.0.653.0.634.0. chunk 24/46
+ 1583357 | 0xffe2 APP2 | 41712 | ICC_PROFILE...0.584.0.555.0.509. chunk 25/9
+ 1625072 | 0xffed APP13 | 3030 | Photoshop 3.0.8BIM..........Z...
+ 1628104 | 0xffee APP14 | 14 | Adobe.d@......
+ 1628120 | 0xffdb DQT | 132
+ 1628254 | 0xffc0 SOF0 | 17
+ 1628273 | 0xffdd DRI | 4
+ 1628279 | 0xffc4 DHT | 418
+ 1628699 | 0xffda SOS
STRUCTURE OF JPEG FILE: Reagan.jpg
address | marker | length | data
0 | 0xffd8 SOI
- 2 | 0xffe0 APP0 | 16 | JFIF.....,.,....
- 20 | 0xffe1 APP1 | 5658 | Exif..MM.*......................
- 5680 | 0xffe1 APP1 | 7024 | http://ns.adobe.com/xap/1.0/.J...a.`1. chunk 12/-113
+ 797177 | 0xffe2 APP2 | 65512 | ICC_PROFILE...up................ chunk 13/-1
+ 862692 | 0xffe2 APP2 | 65512 | ICC_PROFILE....<................ chunk 14/-1
+ 928207 | 0xffe2 APP2 | 65512 | ICC_PROFILE..........,...'.....` chunk 15/9
+ 993722 | 0xffe2 APP2 | 65512 | ICC_PROFILE...g.....m%....qw... chunk 16/0
+ 1059237 | 0xffe2 APP2 | 65512 | ICC_PROFILE..s....xX.M..n.....gO chunk 17/115
+ 1124752 | 0xffe2 APP2 | 65512 | ICC_PROFILE........0......E..... chunk 18/-31
+ 1190267 | 0xffe2 APP2 | 65512 | ICC_PROFILE....(.n.B.........J}a chunk 19/-1
+ 1255782 | 0xffe2 APP2 | 65512 | ICC_PROFILE...282.0.282.0.281.0. chunk 20/46
+ 1321297 | 0xffe2 APP2 | 65512 | ICC_PROFILE...0.176.0.175.0.174. chunk 21/9
+ 1386812 | 0xffe2 APP2 | 65512 | ICC_PROFILE...0.114.0.126.0.136. chunk 22/9
+ 1452327 | 0xffe2 APP2 | 65512 | ICC_PROFILE...049.0.053.0.059.0. chunk 23/46
+ 1517842 | 0xffe2 APP2 | 65512 | ICC_PROFILE..670.0.653.0.634.0.6 chunk 24/54
+ 1583357 | 0xffe2 APP2 | 41712 | ICC_PROFILE..0.584.0.555.0.509.0 chunk 25/48
+ 1625072 | 0xffed APP13 | 3030 | Photoshop 3.0.8BIM..........Z...
+ 1628104 | 0xffee APP14 | 14 | Adobe.d@......
+ 1628120 | 0xffdb DQT | 132
+ 1628254 | 0xfffe COM | 10 | abcdefg
+ 1628266 | 0xffc0 SOF0 | 17
+ 1628285 | 0xffdd DRI | 4
+ 1628291 | 0xffc4 DHT | 418
+ 1628711 | 0xffda SOS
abcdefg
STRUCTURE OF JPEG FILE: Reagan.jpg
address | marker | length | data
0 | 0xffd8 SOI
- 2 | 0xffe0 APP0 | 16 | JFIF.....,.,....
- 20 | 0xffe1 APP1 | 5658 | Exif..MM.*......................
- 5680 | 0xffe1 APP1 | 7024 | http://ns.adobe.com/xap/1.0/.J...a.`1..g chunk 12/79
+ 797177 | 0xffe2 APP2 | 65512 | ICC_PROFILE..up................. chunk 13/117
+ 862692 | 0xffe2 APP2 | 65512 | ICC_PROFILE...<................. chunk 14/-102
+ 928207 | 0xffe2 APP2 | 65512 | ICC_PROFILE.........,...'.....` chunk 15/9
+ 993722 | 0xffe2 APP2 | 65512 | ICC_PROFILE..g.....m%....qw....u chunk 16/103
+ 1059237 | 0xffe2 APP2 | 65512 | ICC_PROFILE......xX.M..n.....gO. chunk 17/-112
+ 1124752 | 0xffe2 APP2 | 65512 | ICC_PROFILE.......0......E.....H chunk 18/-120
+ 1190267 | 0xffe2 APP2 | 65512 | ICC_PROFILE...(.n.B.........J}am chunk 19/-9
+ 1255782 | 0xffe2 APP2 | 65512 | ICC_PROFILE..282.0.282.0.281.0.2 chunk 20/50
+ 1321297 | 0xffe2 APP2 | 65512 | ICC_PROFILE..0.176.0.175.0.174.0 chunk 21/48
+ 1386812 | 0xffe2 APP2 | 65512 | ICC_PROFILE..0.114.0.126.0.136.0 chunk 22/48
+ 1452327 | 0xffe2 APP2 | 65512 | ICC_PROFILE..049.0.053.0.059.0.0 chunk 23/48
+ 1517842 | 0xffe2 APP2 | 65512 | ICC_PROFILE..70.0.653.0.634.0.60 chunk 24/55
+ 1583357 | 0xffe2 APP2 | 41712 | ICC_PROFILE...584.0.555.0.509.0. chunk 25/46
+ 1625072 | 0xffed APP13 | 3030 | Photoshop 3.0.8BIM..........Z...
+ 1628104 | 0xffee APP14 | 14 | Adobe.d@......
+ 1628120 | 0xffdb DQT | 132
+ 1628254 | 0xffc0 SOF0 | 17
+ 1628273 | 0xffdd DRI | 4
+ 1628279 | 0xffc4 DHT | 418
+ 1628699 | 0xffda SOS
+50b9125494306a6fc1b7c4f2a1a8d49d
+50b9125494306a6fc1b7c4f2a1a8d49d
+daa5193ef28659d126c48d4010479428
+daa5193ef28659d126c48d4010479428
+d890d988d312ae8d497d21e936628ecc
+d890d988d312ae8d497d21e936628ecc
diff --git a/test/data/webp-test.out b/test/data/webp-test.out
index 4c52060e..e9d13656 100644
--- a/test/data/webp-test.out
+++ b/test/data/webp-test.out
@@ -283,12 +283,12 @@ STRUCTURE OF WEBP FILE: exiv2-bug1199.webp
XMP | 2864 | 184662 | 1..B.!..o.. ......]..
- EXIF | 12040 | 175200 | II*........................... .
- XMP | 2864 | 187248 | 1..B.!..o.. ......]..
+ EXIF | 12040 | 175198 | II*........................... .
+ XMP | 2864 | 187246 | 1..B.!..o.. ......]..
EXIF | 12040 | 172614 | II*........................... .
- XMP | 1677406 | 184662 |