Hi Larry,

that's awesome. I still didn't have the chance to test this. Thank you. I
will tey to ger to it tomorrow.

Cheers,
Sebastian

On Monday, March 30, 2015, Larry Gritz <[email protected]> wrote:

> As a follow-up, I have implemented the -trim (explicit trim in place) that
> I mentioned on this thread would have been convenient.
>
>  https://github.com/OpenImageIO/oiio/pull/1105
>
>
> On Mar 26, 2015, at 10:13 AM, Larry Gritz <[email protected]
> <javascript:_e(%7B%7D,'cvml','[email protected]');>> wrote:
>
> How about this (presuming it's a 4 channel RGBA):
>
> oiiotool in.exr -dup -mulc 10000 -clamp:min=0:max=1 -ch R=A,G=A,B=A,A -mul
> -autorim -o out.exr
>
> This reads in.exr, duplicates it on the stack, multiplies pixel values
> 10000 then clamps to [0,1] (that has the effect of turning all nonzero
> alpha into 1.0), replicates the thresholded alpha value into all 4
> channels, multiplies that mask by the original image (still below it on the
> stack!) -- now we've squashed all color to 0 in pixels that were original
> alpha 0 -- and finally write it out with autotrim!
>
> I haven't tested this, so take with a grain of salt that I've spelled
> everything correctly and whatnot. But I think the overall methodology is
> sound.
>
> If you are using master (so you have expression substitution), another
> clever trick might be:
>
> oiiotool in.exr --ch A -autotrim -o alphatrim.exr
> oiiotool alphatrim.exr in.exr -crop {IMG[1].geom} -o out.exr
>
> This extracts just the alpha channel and saves to a temporary file with
> auto-trimming. Then it uses the size of the saved auto-trimmed alpha to
> explicitly crop the original. I would prefer to do it in one step, but it
> looks like --autotrim only works upon the saved output of "-o", and I
> neglected to implement a --trim (trim the outer black "in place" so you can
> then use the trimmed image).
>
>
>
> On Mar 25, 2015, at 10:42 PM, Jason Iversen <[email protected]
> <javascript:_e(%7B%7D,'cvml','[email protected]');>> wrote:
>
> Perhaps you can premultiply (--premult) before autotrimming?
>
> On Wed, Mar 25, 2015 at 8:48 PM, Sebastian Kral <[email protected]
> <javascript:_e(%7B%7D,'cvml','[email protected]');>> wrote:
>
>> Hi,
>>
>> I was wondering if it's possible to create a DataWindow in an EXR with
>> the --autotrim flag which is based purely on the Alpha instead of black
>> pixels.
>> We have some rather large mattepaintings which I am trying to trim but
>> since the background isn't black the autotrim doesn't seem to work.
>>
>> Perhaps I am missing something and someone can help me out.
>>
>> The command I am running:
>> oiiotool in.exr --scanline --compress zips --autotrim -o out.exr
>>
>> Thank you.
>>
>> Cheers,
>> Sebastian
>>
>> _______________________________________________
>> Oiio-dev mailing list
>> [email protected]
>> <javascript:_e(%7B%7D,'cvml','[email protected]');>
>> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
>>
>>
>
>
> --
> jason iversen
>   http://www.odforce.net
>  _______________________________________________
> Oiio-dev mailing list
> [email protected]
> <javascript:_e(%7B%7D,'cvml','[email protected]');>
> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
>
>
> --
> Larry Gritz
> [email protected] <javascript:_e(%7B%7D,'cvml','[email protected]');>
>
>
>
> _______________________________________________
> Oiio-dev mailing list
> [email protected]
> <javascript:_e(%7B%7D,'cvml','[email protected]');>
> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
>
>
> --
> Larry Gritz
> [email protected] <javascript:_e(%7B%7D,'cvml','[email protected]');>
>
>
>
>

-- 
Sent from mobile device
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to