Skip to main content
Participating Frequently
April 6, 2011
Question

merge 2 files for masking with alpha channels

  • April 6, 2011
  • 1 reply
  • 1548 views

Dear all,

I have like hundreds of files. Each file has it's own "sister black&white file" which is ment to be used as a mask.

I was wondering if it is possible to automaticly merge those 2 files so we would end up with a masked image..png or whatever....

It would be a monster job to do it all by hand...

Maybe a a script or badge???

kind regards,

This topic has been closed for replies.

1 reply

c.pfaffenbichler
Community Expert
Community Expert
April 6, 2011

What are the naming-rules and the files’ locations (side by side?) and is the Alpha a grayscale image or RGB, too?

Edit: Could you post a pair of files for testing?

Participating Frequently
April 6, 2011

the alpha image will be rgb.

The filenaming is not problem - that we can take care of...

in other words - you can call it whatever you want...

thanx

c.pfaffenbichler
Community Expert
Community Expert
June 16, 2011

Oh ic,

thanx, that is becauseI don't know how to do that....

This just an existing script I adapted...

How do I do that?


You could change the save options to something like:

tifOpts = new TiffSaveOptions() ;      

tifOpts.embedColorProfile = true;      

tifOpts.imageCompression = TIFFEncoding.TIFFLZW;

tifOpts.alphaChannels = false;      

tifOpts.byteOrder = ByteOrder.MACOS;

tifOpts.layers = true;

And the export-line to

var docName = doc.name;

var basename = docName.match(/(.*)\.[^\.]+$/)[1];

doc.saveAs((new File(ofolder + '/' + basename + '.tif')),tifOpts,true)

doc.close(SaveOptions.DONOTSAVECHANGES);

And if you think it would be easier if I just amended the Script, that might be so, but you may pick up more this way, I guess.