# b = ImageBuf() # ImageBufAlgo.mul (b, make_constimage(64,64,3,oiio.HALF,(.1,.2,.3)), # make_constimage(64,64,3,oiio.HALF,(.1,.1,.1),20,20)) # write (b, "mul.exr") # pow b = ImageBuf() ImageBufAlgo.pow(b, gray128, 2) write(b, "cpow1.exr") b = ImageBuf() ImageBufAlgo.pow(b, gray128, (2, 2, 1)) write(b, "cpow2.exr") # channel_sum b = ImageBuf() ImageBufAlgo.channel_sum(b, ImageBuf("../oiiotool/tahoe-small.tif"), (0.2126, 0.7152, 0.0722)) write(b, "chsum.tif", oiio.UINT8) # premult/unpremult b = make_constimage(100, 100, 4, oiio.FLOAT, (0.1, 0.1, 0.1, 1)) ImageBufAlgo.fill(b, (0.2, 0.2, 0.2, 0.5), oiio.ROI(50, 80, 50, 80)) ImageBufAlgo.unpremult(b, b) write(b, "unpremult.tif") ImageBufAlgo.premult(b, b) write(b, "premult.tif") b = ImageBuf("../oiiotool/tahoe-small.tif") ImageBufAlgo.rangecompress(b, b) write(b, "rangecompress.tif", oiio.UINT8) ImageBufAlgo.rangeexpand(b, b) write(b, "rangeexpand.tif", oiio.UINT8)
write(b, "divc1.exr", oiio.HALF) b = ImageBuf() ImageBufAlgo.div(b, gray64, (2.0, 1, 0.5)) write(b, "divc2.exr", oiio.HALF) # pow b = ImageBuf() ImageBufAlgo.pow(b, gray128, 2) write(b, "cpow1.exr") b = ImageBuf() ImageBufAlgo.pow(b, gray128, (2, 2, 1)) write(b, "cpow2.exr") # channel_sum b = ImageBuf() ImageBufAlgo.channel_sum(b, ImageBuf("../oiiotool/tahoe-small.tif"), (.2126, .7152, .0722)) write(b, "chsum.tif", oiio.UINT8) # premult/unpremult b = make_constimage(100, 100, 4, oiio.FLOAT, (.1, .1, .1, 1)) ImageBufAlgo.fill(b, (.2, .2, .2, .5), oiio.ROI(50, 80, 50, 80)) ImageBufAlgo.unpremult(b, b) write(b, "unpremult.tif") ImageBufAlgo.premult(b, b) write(b, "premult.tif") b = ImageBuf("../oiiotool/tahoe-small.tif") ImageBufAlgo.rangecompress(b, b) write(b, "rangecompress.tif", oiio.UINT8) ImageBufAlgo.rangeexpand(b, b) write(b, "rangeexpand.tif", oiio.UINT8)
a = ImageBuf ("../oiiotool/src/tahoe-small.tif") b = ImageBuf() ImageBufAlgo.invert (b, a) write (b, "invert.tif", oiio.UINT8) # pow b = ImageBuf() ImageBufAlgo.pow (b, gray128, 2) write (b, "cpow1.exr") b = ImageBuf() ImageBufAlgo.pow (b, gray128, (2,2,1)) write (b, "cpow2.exr") # channel_sum b = ImageBuf() ImageBufAlgo.channel_sum (b, ImageBuf("../oiiotool/src/tahoe-small.tif"), (.2126,.7152,.0722)) write (b, "chsum.tif", oiio.UINT8) # premult/unpremult b = make_constimage(100,100,4,oiio.FLOAT,(.1,.1,.1,1)) ImageBufAlgo.fill (b, (.2,.2,.2,.5), oiio.ROI(50,80,50,80)) ImageBufAlgo.unpremult (b, b) write (b, "unpremult.tif") ImageBufAlgo.premult (b, b) write (b, "premult.tif") b = ImageBuf ("../oiiotool/src/tahoe-small.tif") ImageBufAlgo.rangecompress (b, b) write (b, "rangecompress.tif", oiio.UINT8) ImageBufAlgo.rangeexpand (b, b) write (b, "rangeexpand.tif", oiio.UINT8)
write(b, "divc2.exr", oiio.HALF) # invert a = ImageBuf(OIIO_TESTSUITE_ROOT + "/oiiotool/src/tahoe-small.tif") b = ImageBufAlgo.invert(a) write(b, "invert.tif", oiio.UINT8) # pow b = ImageBufAlgo.pow(gray128, 2) write(b, "cpow1.exr") b = ImageBufAlgo.pow(gray128, (2, 2, 1)) write(b, "cpow2.exr") # channel_sum b = ImageBufAlgo.channel_sum( ImageBuf(OIIO_TESTSUITE_ROOT + "/oiiotool/src/tahoe-small.tif"), (.2126, .7152, .0722)) write(b, "chsum.tif", oiio.UINT8) # color_map b = ImageBufAlgo.color_map(tahoetiny, -1, "inferno") write(b, "colormap-inferno.tif", oiio.UINT8) b = ImageBufAlgo.color_map(tahoetiny, -1, 3, 3, (.25, .25, .25, 0, .5, 0, 1, 0, 0)) write(b, "colormap-custom.tif", oiio.UINT8) # premult/unpremult b = make_constimage(100, 100, 4, oiio.FLOAT, (.1, .1, .1, 1)) ImageBufAlgo.fill(b, (.2, .2, .2, .5), oiio.ROI(50, 80, 50, 80)) b = ImageBufAlgo.unpremult(b) write(b, "unpremult.tif")
write(b, "divc2.exr", oiio.HALF) # invert a = ImageBuf(OIIO_TESTSUITE_ROOT + "/common/tahoe-small.tif") b = ImageBufAlgo.invert(a) write(b, "invert.tif", oiio.UINT8) # pow b = ImageBufAlgo.pow(gray128, 2) write(b, "cpow1.exr") b = ImageBufAlgo.pow(gray128, (2, 2, 1)) write(b, "cpow2.exr") # channel_sum b = ImageBufAlgo.channel_sum( ImageBuf(OIIO_TESTSUITE_ROOT + "/common/tahoe-small.tif"), (.2126, .7152, .0722)) write(b, "chsum.tif", oiio.UINT8) # min, max (per element) lrramp64 = ImageBufAlgo.fill((0, 0, 0), (1, 1, 1), (0, 0, 0), (1, 1, 1), oiio.ROI(0, 64, 0, 64, 0, 1, 0, 3)) b = ImageBufAlgo.max(lrramp64, gray64) write(b, "maximg.tif", oiio.UINT8) b = ImageBufAlgo.max(lrramp64, (0.25, 0.25, 0.25)) write(b, "maxval.tif", oiio.UINT8) b = ImageBufAlgo.min(lrramp64, gray64) write(b, "minimg.tif", oiio.UINT8) b = ImageBufAlgo.min(lrramp64, (0.25, 0.25, 0.25)) write(b, "minval.tif", oiio.UINT8)