Fix issue #4291 : "Bug when edit current image in external editor"

Is also add metadata to the "ICC Reference image" (ICM tool).
This commit is contained in:
Hombre
2018-01-10 18:22:50 +01:00
parent e29e9ca0d8
commit 91e494a709
2 changed files with 2 additions and 21 deletions

View File

@@ -1484,30 +1484,9 @@ int ImageIO::saveTIFF (Glib::ustring fname, int bps, bool uncompressed)
TIFFSetField (out, TIFFTAG_ICCPROFILE, profileLength, profileData);
}
#if __BYTE_ORDER__==__ORDER_LITTLE_ENDIAN__
bool needsReverse = (bps == 16 || bps == 32) && exifRoot && exifRoot->getOrder() == rtexif::MOTOROLA;
#else
bool needsReverse = (bps == 16 || bps == 32) && exifRoot && exifRoot->getOrder() == rtexif::INTEL;
#endif
for (int row = 0; row < height; row++) {
getScanline (row, linebuffer, bps);
if (needsReverse) {
if (bps == 16) {
for (int i = 0; i < lineWidth; i += 2) {
char c = linebuffer[i];
linebuffer[i] = linebuffer[i + 1];
linebuffer[i + 1] = c;
}
} else {
for (int i = 0; i < lineWidth; i += 4) {
std::swap(linebuffer[i], linebuffer[i+3]);
std::swap(linebuffer[i+1], linebuffer[i+2]);
}
}
}
if (TIFFWriteScanline (out, linebuffer, row, 0) < 0) {
TIFFClose (out);
delete [] linebuffer;

View File

@@ -1284,6 +1284,8 @@ void ImProcCoordinator::saveInputICCReference (const Glib::ustring& fname, bool
im = tempImage;
}
im->setMetadata (imgsrc->getMetaData()->getRootExifData ());
im->saveTIFF (fname, 16, true);
delete im;