Reviews, updates and in depth guides to your favourite mobile games - AppGamer.com
|
|
Using pixels instead of inches when recording an action? |
Page: 1 | Reply |
Mar 3rd 2007 | #176417 Report |
Member since: Mar 3rd 2007 Posts: 2 |
I have recorded an action that will automatically place a logo in the upper left corner of every image. There are 4 steps after pasting the logo onto the image (and before saving it): 1. Align current layer (using: top edges) 2. Align current layer (using: left edges) 3. Set selection (to: none) 4. Move current layer (to: 0.139 inches, 0.139 inches) There are no errors when I use File > Automate > Batch on a large number of pictures. However, the problem I'm encountering is that it has recorded the "move current layer" measurements in inches. Since each picture is a different size, it's moving the logo much farther on some pictures than on others. Is there a way to edit the actions dialog to use pixels when I'm recording an action? Or another alternative way to get it to record the location of the logo so that it's consistent no matter what the size of the picture? |
Reply with Quote Reply |
Mar 4th 2007 | #176418 Report |
Member since: Mar 27th 2001 Posts: 2237 |
Not sure why you would need to give the script an align function if you want the end result to be in the upper left corner. Anyway, from your action after the paste you can use this script to move the layer. It finds the top left corner of the layer's bounding box and moves the layer to 10 pixels from the left and 10 pixels from the top. You can change the placement by changing myPosition. var defaultRulerUnits = app.preferences.rulerUnits; app.preferences.rulerUnits = Units.PIXELS; var bnds = activeDocument.activeLayer.bounds var currentLeft = parseInt(bnds[0]); var currentTop = parseInt(bnds[1]); [COLOR="Red"]var myPosition = [10,10];//left,top[/COLOR] activeDocument.activeLayer.translate(myPosition[0]-currentLeft,myPosition[1]-currentTop) app.preferences.rulerUnits = defaultRulerUnits However it works using pixels so placement might be an issue if all your images are not the same resolution. If they are all 300 dpi or all 72 dpi or whatever it will work nicely. |
Reply with Quote Reply |
Mar 4th 2007 | #176423 Report |
Member since: Mar 3rd 2007 Posts: 2 |
Is there a tutorial that can tell me how to input that in the actions dialog? I'm used to just pressing "record" and going about it that way. And I want to move it ten pixels from the top and ten pixels from the right because I don't want the top left edges of the logo to be flush with the top left edges of the picture. |
Reply with Quote Reply |
Mar 4th 2007 | #176427 Report |
Member since: Mar 27th 2001 Posts: 2237 |
copy/paste the above script into notepad save and name it whatever.js You drop that script file in the folder... photoshop / presets / scripts then add calling that script to your action by re-recording and going FILE>SCRIPTS>whateveryounamedthescript.js in the appropriate place in the sequence. I thought you wanted the logo in the top left corner. If it is to close to the edges you can make it 20,20 or 100,100 instead of 10,10. That just depends on the resolution of the image. 10 pixels in a 150 or 300 dpi image is nothing. In a 72 dpi image however it is a pretty good amount of space. Hope this helps. |
Reply with Quote Reply |
Page: 1 | Back to top |
Please login or register above to post in this forum |
© Web Media Network Limited. All rights reserved. No part of this website may be reproduced without written permission. Photoshop is a registered trademark of Adobe Inc.. TeamPhotoshop.com is not associated in any way with Adobe, nor is an offical Photoshop website. |