Just tried it, works! :-) Is it possible to resize before paste and preserve the original width/ height of the image? So keeping the width/ height + resize -2*$BORDER?
Something like: ./oiiotool /Volumes/Build/test/test-75.jpg --pattern constant:color=0.2,0.2,0.2,1.0 "{TOP.width}x{TOP.height}" "{TOP.nchannels}" —-resize “{TOP.width-2*40}x{TOP.height-2*40}” --paste "+40+40” -o /Volumes/Build/test/test_frame.png Mikael Best regards, Mikael Sundell mikael.sund...@gmail.com > On 17 Oct 2021, at 19:16, Larry Gritz <l...@larrygritz.com> wrote: > > Maybe something like > > BORDER=40 > COLOR=.2,.2,.2,1.0 > oiiotool input.tif --pattern constant:color=$COLOR > "{TOP.width+2*$BORDER}x{TOP.height+2*$BORDER}" "{TOP.nchannels}" --paste > "+$BORDER+$BORDER" -o output.tif > > Note the use of oiiotool's {expression substitution} so that you don't need > to know the resolution of the input image. > > Breakdown: > > oiiotool # you know what that is > input.tif # read input image, put it on the stack > --pattern constant <size> <chans> # push a constant-colored image on > the stack > # note: at this point, input.tif is > now > # the 2nd from top image. > --paste <offset> # paste the 2nd-from-top image on the top image > # .. at the given offset coordinate > -o output.tif # write the result here > > Details: > > In expressions, TOP is the image currently on the top of the stack (that is, > input.tif, since the constant image hasn't been pushed yet, when the > arguments to --pattern are still being evaluated). So TOP.width, TOP.height, > and TOP.nchannels are the resolution and number of channels of input.tif. > Therefore, {TOP.width+2*$BORDER}x{TOP.height+2*$BORDER} will expand to > something like "2000x1160" if input.tif was 1920x1080 and BORDER was set to > 40. > > > >> On Oct 17, 2021, at 7:00 AM, Mikael Sundell <mikael.sund...@gmail.com >> <mailto:mikael.sund...@gmail.com>> wrote: >> >> Hey all, >> >> I’ve been away for some time and now playing with OpenImageIO and Lightroom, >> is it possible to somehow generate a border around an image with something >> like a resize 7-80% + fill with white/ black or any other color using the >> command line tools? >> >> Remember doing this in the past using olio c++ and Qt/ pixmaps. >> >> Thanks :-) >> >> Mikael >> >> >> Best regards, >> >> Mikael Sundell >> mikael.sund...@gmail.com <mailto:mikael.sund...@gmail.com> >> >> _______________________________________________ >> Oiio-dev mailing list >> Oiio-dev@lists.openimageio.org >> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org > > -- > Larry Gritz > l...@larrygritz.com <mailto:l...@larrygritz.com> > > > > > _______________________________________________ > Oiio-dev mailing list > Oiio-dev@lists.openimageio.org > http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
_______________________________________________ Oiio-dev mailing list Oiio-dev@lists.openimageio.org http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org