Skip to content

Commit 2cc3b0a

Browse files
committed
API for setting profile name for PNGs
1 parent 7715493 commit 2cc3b0a

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

include/exiv2/image.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class EXIV2API Image {
192192
*/
193193
virtual void setIccProfile(DataBuf&& iccProfile, bool bTestValid = true);
194194
/*!
195-
@brief Erase iccProfile. the profile is not removed from
195+
@brief Erase iccProfile. The profile is not removed from
196196
the actual image until the writeMetadata() method is called.
197197
*/
198198
virtual void clearIccProfile();

include/exiv2/pngimage.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,20 @@ class EXIV2API PngImage : public Image {
5353
@warning This function is not thread safe and intended for exiv2 -pS for debugging.
5454
*/
5555
void printStructure(std::ostream& out, PrintStructureOption option, size_t depth) override;
56+
/*!
57+
@brief Set the image iccProfile. The new profile is not written
58+
to the image until the writeMetadata() method is called.
59+
@param iccProfile DataBuf containing profile (binary)
60+
@param bTestValid - tests that iccProfile contains credible data
61+
@param profileName Name for referring to the profile
62+
*/
63+
void setIccProfile(DataBuf&& iccProfile, bool bTestValid = true,
64+
const std::string& profileName = std::string("ICC Profile"));
65+
/*!
66+
@brief Erase iccProfile. The profile is not removed from
67+
the actual image until the writeMetadata() method is called.
68+
*/
69+
void clearIccProfile();
5670
//@}
5771

5872
//! @name Accessors

src/pngimage.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,16 @@ void PngImage::printStructure(std::ostream& out, PrintStructureOption option, si
373373
}
374374
}
375375

376+
void PngImage::setIccProfile(DataBuf&& iccProfile, bool bTestValid, const std::string& profileName) {
377+
profileName_ = profileName;
378+
Image::setIccProfile(std::move(iccProfile), bTestValid);
379+
}
380+
381+
void PngImage::clearIccProfile() {
382+
profileName_ = std::string("ICC Profile");
383+
Image::clearIccProfile();
384+
}
385+
376386
void readChunk(DataBuf& buffer, BasicIo& io) {
377387
#ifdef EXIV2_DEBUG_MESSAGES
378388
std::cout << "Exiv2::PngImage::readMetadata: Position: " << io.tell() << std::endl;

0 commit comments

Comments
 (0)