Skip to content

Commit

Permalink
Fix ICC propagation for non ASCII filenames under Win
Browse files Browse the repository at this point in the history
  • Loading branch information
trufanov-nok committed Oct 21, 2021
1 parent 586c704 commit c1a7d79
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/core/filters/output/ImageMetadataCopier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
bool
ImageMetadataCopier::iccProfileDefined(const QString& filename)
{
#ifdef _WIN32
const Exiv2::Image::AutoPtr src_image = Exiv2::ImageFactory::open(filename.toStdWString());
#else
const Exiv2::Image::AutoPtr src_image = Exiv2::ImageFactory::open(filename.toStdString());
#endif
if (src_image.get()) {
src_image->readMetadata();
return src_image->iccProfileDefined();
Expand All @@ -20,13 +24,22 @@ ImageMetadataCopier::copyMetadata(const QString& src_img,
{
try
{
const Exiv2::Image::AutoPtr src_image = Exiv2::ImageFactory::open(src_img.toStdString());
#ifdef _WIN32
const Exiv2::Image::AutoPtr src_image = Exiv2::ImageFactory::open(src_img.toStdWString());
#else
const Exiv2::Image::AutoPtr src_image = Exiv2::ImageFactory::open(src_img.toStdString());
#endif

if (src_image.get()) {
src_image->readMetadata();

if (src_image->iccProfileDefined()) {
src_image->iccProfile();
Exiv2::Image::AutoPtr dst_image = Exiv2::ImageFactory::open(dst_img.toStdString());
#ifdef _WIN32
const Exiv2::Image::AutoPtr dst_image = Exiv2::ImageFactory::open(dst_img.toStdWString());
#else
const Exiv2::Image::AutoPtr dst_image = Exiv2::ImageFactory::open(dst_img.toStdString());
#endif
dst_image->readMetadata();
dst_image->setIccProfile(*src_image->iccProfile());
dst_image->writeMetadata();
Expand Down

0 comments on commit c1a7d79

Please sign in to comment.