refactored code for extracting image dimensions from metadata

(cherry picked from commit 0ece9c5bfad09bc9052238d83fa696ef39effaaa)
This commit is contained in:
Alberto Griggio
2020-12-02 02:03:00 -08:00
committed by Lawrence Lee
parent 0102fca563
commit 92befa7e81
13 changed files with 146 additions and 21 deletions

View File

@@ -56,7 +56,9 @@ CacheImageData::CacheImageData() :
greenAWBMul(-1.0),
blueAWBMul(-1.0),
rotate(0),
thumbImgType(0)
thumbImgType(0),
width(-1),
height(-1)
{
}
@@ -208,6 +210,12 @@ int CacheImageData::load (const Glib::ustring& fname)
if (keyFile.has_key ("FileInfo", "SampleFormat")) {
sampleFormat = (rtengine::IIO_Sample_Format)keyFile.get_integer ("FileInfo", "SampleFormat");
}
if (keyFile.has_key("FileInfo", "Width")) {
width = keyFile.get_integer("FileInfo", "Width");
}
if (keyFile.has_key("FileInfo", "Height")) {
height = keyFile.get_integer("FileInfo", "Height");
}
}
if (format == FT_Raw && keyFile.has_group ("ExtraRawInfo")) {
@@ -298,6 +306,8 @@ int CacheImageData::save (const Glib::ustring& fname)
keyFile.set_string ("FileInfo", "Filetype", filetype);
keyFile.set_integer ("FileInfo", "FrameCount", frameCount);
keyFile.set_integer ("FileInfo", "SampleFormat", sampleFormat);
keyFile.set_integer("FileInfo", "Width", width);
keyFile.set_integer("FileInfo", "Height", height);
if (format == FT_Raw) {
keyFile.set_integer ("ExtraRawInfo", "ThumbImageType", thumbImgType);