Keep/discard alfa depending on opacity
Keep/discard alfa depending on opacity
I want to batch convert multiple PSD to a TIFF files without layers. If I am not mistaken, I can just grab the composite version of the PSD by appending [0] to its filename, but then, regarding the alpha, is there a way to programmatically keep it or discard it depending on whether there actually exists any non-opaque pixel in the image at all or discard it if not? Even better, could that test ignore the outmost n-pixels in the four edges of the image?
Re: Keep/discard alfa depending on opacity
I found that I can query if the composite PSD "is image fully-opaque?" with
Code: Select all
identify -format %[opaque] ${PSD}[0]
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Keep/discard alfa depending on opacity
Yes. I would do it in a script. Convert it, and test for %[opaque] in the result. If "True" then convert again with "-alpha off".
If you want to ignore some pixels for the test, then crop or shave the image.
If you want to ignore some pixels for the test, then crop or shave the image.
snibgo's IM pages: im.snibgo.com