oiiotool.exe C:\temp\ataafm_diff_v001.1005.tif -resize 120x120 -o 
c:/temp/test_oiio_tool.jpg

From: Larry Gritz <[email protected]>
Sent: Friday, December 28, 2018 1:05 PM
To: OpenImageIO developers <[email protected]>; Renaud Talon 
<[email protected]>; [email protected]
Subject: Re: [Oiio-dev] Tiff image conversion to jpg color shift issue

What oiiotool command line did you use when it worked as expected?


On December 28, 2018 12:36:04 PM PST, Renaud Talon 
<[email protected]<mailto:[email protected]>> wrote:
Hi Larry,

I’m having a problem when making thumbnails from tiff images where the results 
image is coming out darker and less saturated than the source.
When using oiiotool.exe it results in a proper output but the issue happens 
when I do the conversion myself from the python API.
Any idea why this is happening ?
Thanks !

Trimmed down code:
from OpenImageIO import OpenImageIO as oiio
from OpenImageIO.OpenImageIO import ImageBufAlgo, ImageBuf, ImageSpec, 
ImageInput


sourceImgPath = "C:/temp/ataafm_diff_v001.1005.tif"

sourceImg = ImageInput.open(sourceImgPath)
spec = sourceImg.spec()

pixels = sourceImg.read_image(0, 3, oiio.UINT8)

sourceBufSpec = ImageSpec(spec.width, spec.height, 3, oiio.UINT8)
sourceBuf = ImageBuf(sourceBufSpec)
sourceBuf.set_pixels(oiio.ROI.All, pixels)

resizedImgSpec = ImageSpec(int(120), int(120), 3, oiio.UINT8)
resizedBuf = ImageBuf(resizedImgSpec)

ImageBufAlgo.resample(resizedBuf, sourceBuf)

# Set input colorspace to linear if converting EXR file
if sourceImgPath.split('.')[-1] == 'exr':
    ImageBufAlgo.colorconvert(resizedBuf, resizedBuf, 'linear', 'sRGB')

resizedBuf.write('C:/temp/test_oiio.jpg')


[cid:[email protected]]

Renaud

--
Larry Gritz
[email protected]<mailto:[email protected]>
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to