33
44#include < terry/globals.hpp>
55#include < terry/openexr/half.hpp>
6+ #include < terry/color/components.hpp>
67
78#include < tuttle/plugin/exceptions.hpp>
89
@@ -483,6 +484,7 @@ void OpenImageIOWriterProcess<View>::writeImage(View& src, const std::string& fi
483484{
484485 using namespace boost ;
485486 using namespace OpenImageIO ;
487+ using namespace terry ::color::components;
486488
487489 boost::scoped_ptr<ImageOutput> out (ImageOutput::create (filepath));
488490 if (out.get () == NULL )
@@ -491,8 +493,10 @@ void OpenImageIOWriterProcess<View>::writeImage(View& src, const std::string& fi
491493 }
492494 WImage img (src.width (), src.height ());
493495
496+ ConvertionParameters parameters;
497+ parameters.premultiplied = params._premultiply ;
494498 typename WImage::view_t vw (view (img));
495- copy_and_convert_pixels (src, vw);
499+ convertComponentsView (src, vw, parameters );
496500
497501 OpenImageIO::TypeDesc oiioBitDepth;
498502 size_t sizeOfChannel = 0 ;
@@ -557,7 +561,7 @@ void OpenImageIOWriterProcess<View>::writeImage(View& src, const std::string& fi
557561 spec.attribute (" Copyright" , params._copyright );
558562
559563 spec.attribute (" oiio:BitsPerSample" , bitsPerSample);
560- spec.attribute (" oiio:UnassociatedAlpha" , params._premultiply );
564+ spec.attribute (" oiio:UnassociatedAlpha" , ! params._premultiply );
561565 spec.attribute (" CompressionQuality" , params._quality );
562566 spec.attribute (" Orientation" , params._orientation + 1 );
563567
@@ -612,7 +616,7 @@ void OpenImageIOWriterProcess<View>::writeImage(View& src, const std::string& fi
612616 typedef typename boost::gil::channel_type<WImage>::type channel_t ;
613617
614618 out->write_image (oiioBitDepth,
615- &((*vw.begin ())[0 ]), // get the adress of the first channel value from the first pixel
619+ &((*vw.begin ())[0 ]), // get the address of the first channel value from the first pixel
616620 xstride, ystride, zstride, &progressCallback, this );
617621
618622 out->close ();
0 commit comments