Skip to content

Commit

Permalink
API for setting profile name for PNGs
Browse files Browse the repository at this point in the history
  • Loading branch information
kmilos committed Sep 19, 2022
1 parent 7715493 commit 673fdb7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion include/exiv2/image.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class EXIV2API Image {
*/
virtual void setIccProfile(DataBuf&& iccProfile, bool bTestValid = true);
/*!
@brief Erase iccProfile. the profile is not removed from
@brief Erase iccProfile. The profile is not removed from
the actual image until the writeMetadata() method is called.
*/
virtual void clearIccProfile();
Expand Down
14 changes: 14 additions & 0 deletions include/exiv2/pngimage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,20 @@ class EXIV2API PngImage : public Image {
@warning This function is not thread safe and intended for exiv2 -pS for debugging.
*/
void printStructure(std::ostream& out, PrintStructureOption option, size_t depth) override;
/*!
@brief Set the image iccProfile. The new profile is not written
to the image until the writeMetadata() method is called.
@param iccProfile DataBuf containing profile (binary)
@param bTestValid - tests that iccProfile contains credible data
@param profileName Name for referring to the profile
*/
void setIccProfile(DataBuf&& iccProfile, bool bTestValid = true,
const std::string& profileName = std::string("ICC Profile"));
/*!
@brief Erase iccProfile. The profile is not removed from
the actual image until the writeMetadata() method is called.
*/
void clearIccProfile() override;
//@}

//! @name Accessors
Expand Down
10 changes: 10 additions & 0 deletions src/pngimage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,16 @@ void PngImage::printStructure(std::ostream& out, PrintStructureOption option, si
}
}

void PngImage::setIccProfile(DataBuf&& iccProfile, bool bTestValid, const std::string& profileName) {
profileName_ = profileName;
Image::setIccProfile(std::move(iccProfile), bTestValid);
}

void PngImage::clearIccProfile() {
profileName_ = std::string("ICC Profile");
Image::clearIccProfile();
}

void readChunk(DataBuf& buffer, BasicIo& io) {
#ifdef EXIV2_DEBUG_MESSAGES
std::cout << "Exiv2::PngImage::readMetadata: Position: " << io.tell() << std::endl;
Expand Down

0 comments on commit 673fdb7

Please sign in to comment.