Ok, so this is my first script that I am trying to do within Photoshop… I am trying to avoid using Photoshop actions for a host of reasons.
So, I have a 5x7, 300 dpi image.
What I am trying to do is copy the contents, set the canvas size to 10x8, paste the clipboard into another layer, and position the contents of next to the original image.
I have the following:
tell application "Adobe Photoshop CS"
activate
set foreground color to {class:RGB color, red:255, green:255, blue:255}
set background color to {class:RGB color, red:255, green:255, blue:255}
tell current document
select all
copy
resize canvas anchor position top left width (10) height (8)
paste
set current layer to layer "Layer 1"
select contents
move selection to {5, 0}
end tell
end tell
The script errors out on the selection process of the contents of “Layer 1.” Can someone point me in the right direction.
I found the paste clipping to selection command - so, this is what I have done…
tell application "Adobe Photoshop CS"
activate
set foreground color to {class:RGB color, red:255, green:255, blue:255}
set background color to {class:RGB color, red:255, green:255, blue:255}
tell current document
select all
copy
resize canvas anchor position top left width (10) height (8)
set MySelect1 to select region {{1501, 0}, {3000, 0}, {3000, 2100}, {1501, 2100}}
paste with clipping to selection
end tell
end tell
Scott, not sure what you are doing here could you explain a bit further.
tell application "Adobe Photoshop CS"
activate
set background color to {class:RGB color, red:255, green:255, blue:255}
tell current document
set background layer of layer 1 to false
resize canvas anchor position top left width (10) height (8)
end tell
end tell
Scott, its better to use duplicate within or detween documents rather than select all a copy, this can lead to some large files in the clip-board. For photoshop I also prefer to use pixel units. Pasting into an active selection will also create a layer mask which you may not require. Your selection array leaves a 1 pixel gap did you want this?
tell application "Adobe Photoshop CS"
activate
set ruler units of settings to pixel units
set background color to {class:RGB color, red:255, green:255, blue:255}
tell current document
duplicate layer 1
resize canvas anchor position top left width 3000 height 2400
set current layer to layer 1
translate layer 1 delta x pixels 1500
end tell
end tell
Photoshop’s edit menue has a purge command for the same caches as the script command, so if you have a large history or item in the clip board you can purge it to clear it from memory.