Skip to content

Commit 86ed9ee

Browse files
committed
Merge pull request #548 from cchampet/fix_oiioPixelAspectRatioOfJpeg
Fix oiio pixel aspect ratio of jpeg
2 parents a60a5a3 + b2e5eb0 commit 86ed9ee

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

plugins/image/io/OpenImageIO/src/mainEntry.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#define OFXPLUGIN_VERSION_MAJOR 1
2-
#define OFXPLUGIN_VERSION_MINOR 2
2+
#define OFXPLUGIN_VERSION_MINOR 3
33

44
#include <tuttle/plugin/Plugin.hpp>
55
#include "reader/OpenImageIOReaderPluginFactory.hpp"

plugins/image/io/OpenImageIO/src/reader/OpenImageIOReaderPlugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ void OpenImageIOReaderPlugin::getClipPreferences(OFX::ClipPreferencesSetter& cli
177177
}
178178
}
179179

180-
float par = spec.get_float_attribute("PixelAspectRatio", 1.0f);
180+
const float par = spec.get_float_attribute("PixelAspectRatio", 1.0f);
181181
clipPreferences.setPixelAspectRatio(*this->_clipDst, par);
182182
in->close();
183183
}

plugins/image/io/OpenImageIO/src/writer/OpenImageIOWriterProcess.tcc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,8 +547,13 @@ void OpenImageIOWriterProcess<View>::writeImage(View& src, const std::string& fi
547547
spec.attribute("CompressionQuality", params._quality);
548548
spec.attribute("Orientation", params._orientation);
549549

550+
// write par, xdensity and ydensity to the output
551+
// Some formats (ie. TIF, JPEG...) make the difference between those attributes.
552+
// Some others (ie. DPX...) don't have density attributes and ignore them.
550553
const float par = _plugin._clipSrc->getPixelAspectRatio();
551554
spec.attribute("PixelAspectRatio", par);
555+
spec.attribute("XResolution", par);
556+
spec.attribute("YResolution", 1);
552557

553558
if(!out->open(filepath, spec))
554559
{

0 commit comments

Comments
 (0)