Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Scripting
Viewing all articles
Browse latest Browse all 12244

Properly placing a selection from a separate image into document?

$
0
0

Hello,

I'm having an issue with a script I am trying to write. The goal of the script is to open 256x256 pixel .PNG files that contain labels and nothing else (transparent background, and black text). We want to apply various effects to the text. To do this properly, we need to stitch the adjacent tiles around the main tile in question, because text could overlap into surrounding tiles.

 

My script does the following:

1) Open a tile.

2) Expand canvas to 768x768 with the tile from step 1 in the center (this makes a 3x3 grid for the surrounding tiles to be placed).

3) Loop through the adjacent tiles and open them one at a time.

  3a) Select the entire tile.

  3b) Paste tile into main document.

  3c) Translate tile to proper position.

4) Apply effects.

5) Crop middle tile back to 256x256

6) Save tile.

 

The problem comes in Step 3. When I pause my script, I can see that 3a indeed places a 256x256 rectangle around the image and copies it. However, when it is pasted into the main document, things change. Basically, the selection is now only the text itself, instead of a 256x256 block. So translation is effectively completely off, because the size of the selection can change depending on what text the tile contains.

 

Is there any way to force the pasted selection to continue to be 256x256 and include the transparent pixels?

 

Thanks!

Chris


Viewing all articles
Browse latest Browse all 12244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>