Hello, can anyone give me a point to start with this script?
I have a bunch of images and in a separate file the alpha layer of each image, named the same but with the _a prefix,.I am trying to merge that two images into a single one with the alpha channel included.
Preview can’t do it, nor can Image Events. But iMagine Photo can. Though how you do it in iMagine Photo will depend on more details. iMagine Photo is free.
When you say the alpha channel is included in another file. Does that mean the other file contains a greyscale image that is the transparency information, or does it contain an image with an alpha channel that you then want to add to your image without an alpha channel?
Are the dimensions in pixels of the image and the alpha layer the same?
What sort of image files are you storing the data in.
Photoshop, tiff, png, jpg etc?
What is the output image format?
tell application "Adobe Photoshop CS"
set x to document 1
set y to document 2
set z to count of channels of x
set current document to x
duplicate channel 5 of x to y
end tell
The files are the same size and the alpha ones contains a graylevel image with the alpha information
I never use imaginePhoto, I am going to check it and also try the “duplicate” way for Photoshop
Thanks a lot!
now I am triyng to load the alpha image when I drop the image, the alpha image is in the same folder and ends with _a but when I try to modify the path I got in troubles
The code below doesnt work because add the _a sufix after the .jpg extension, any ideas?
thanks
on open these_items
tell application "Finder"
repeat with i from 1 to the count of these_items
set this_item to (item i of these_items)
set alphapath to (((this_item) as text) & "_a")
copy alphapath as alias to filePath
--open indesign and save as indesign
tell application "Adobe Photoshop CS2"
open this_item
open filePath
-- set x to document 1 the image
-- set y to document 2 the alpha channel
-- set current document to y
-- duplicate channel 2 of y to x
end tell
set label index of this_item to 5
end repeat
end tell
end open
Hello again, I am doing my homework, now I can extract the path info and add the sufix _a.jpg, now I think I have the path for my alpha file but Photoshop doesnt open anything.
I am pretty newbie in applescript, could anyone help me, please?
Thanks for your time
on open these_items
tell application "Finder"
repeat with i from 1 to the count of these_items
set this_item to (item i of these_items)
set passvariable1 to ((this_item) as string)
set passvariable2 to count passvariable1
set passvariable3 to text from beginning to character (passvariable2 - 4) of passvariable1
set alphapath to passvariable3 & "_a.jpg"
--open indesign and save as indesign
tell application "Adobe Photoshop CS2"
open alphapath
-- set x to document 1 the image
-- set y to document 2 the alpha channel
-- set current document to y
-- duplicate channel 2 of y to x
end tell
set label index of this_item to 5
end repeat
end tell
end open
weedinner, the variable alphapath is the complete path to the alpha image file, the problem was that i didnt coerce as a alias variable, I use this way to process a lot of files -using the script as a drag n drop app- because is the only way that I know yet.
It is really nice for me to learn applescript it has a soft learning curve and in a few days you can start to write useful scripts