• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

How to resize layer in percentage relative to image size?

Guest
May 02, 2013 May 02, 2013

Copy link to clipboard

Copied

Hi,

Say I have an image that is 100x100 pixles. And I want to take one of the layers and resize it to 50% of the image size, so that it is 50 pixles. How can I accomplish that?

The reason I ask, is that have multiple images all with different size. But I have a signature (ie. watermark) that is always the same size. I want to be able to place this signature, and then resize it to XX% of the image it was placed on. That way, it should always have the same proportions.

Thanks in advance!

Views

39.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Adobe Employee ,
May 02, 2013 May 02, 2013

Copy link to clipboard

Copied

You can scale by percentage of the original layer size going to Edit > Transform > Scale. In the transform options menu, there is an option to scale by percentage - just make sure that you click on the link icon between the Height and Width fields to maintain the aspect ratio of your layer.

Screen Shot 2013-05-02 at 10.47.42 AM.jpg Screen Shot 2013-05-02 at 10.47.53 AM.jpg

However, if you wanted to scale a layer relative to the canvas size, I think you would need to do some scripting or use actions... you might want to ask around on the Photoshop General Discussion or Photoshop Scripting forums to see if anyone has a solution.

Kendall

(Edited - misinterpreted original question)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 02, 2013 May 02, 2013

Copy link to clipboard

Copied

Yea, the latter is what I'm seeking. So should I re-post this in the other forum or should this post be transfered there by a moderator?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
May 02, 2013 May 02, 2013

Copy link to clipboard

Copied

I went ahead and moved this thread over to the Photoshop General Discussion forum. You may want to repost your original question on the Scripting forum so that I'm not bouncing you all over the place

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 02, 2013 May 02, 2013

Copy link to clipboard

Copied

Much obliged

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 02, 2013 May 02, 2013

Copy link to clipboard

Copied

If you want to batch process, Picture Processor will let you add your logo/watermark @ a  percentage of the document....

http://www.scriptsrus.talktalk.net/PP.htm

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
May 02, 2013 May 02, 2013

Copy link to clipboard

Copied

I looked into using it, but I didn't find it would work with my current actions. Which are to place the watermark, save the image, then remove the watermark, resize the image, save it again and then remove the watermark again, resize the image and place the watermark again and save it again.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 02, 2013 May 02, 2013

Copy link to clipboard

Copied

shaibn wrote:

I looked into using it, but I didn't find it would work with my current actions. Which are to place the watermark, save the image, then remove the watermark, resize the image, save it again and then remove the watermark again, resize the image and place the watermark again and save it again.

If all those save are for the same image file format or a mixture of image file formats the perfect script for you would be the Image Processor Pro plug-in script downloadable from  Russell Browns web site.  Once installed you will find it under menu File>Automate>Image Processor Pro... All your action needs to do is add the watermark.  It need do no resizing of images and no saving of images the what the script does. You action does not need to remove the watermark. Each image will start from a copy of the original image you can have the image processor pro do the resize before or after your action(s) is played.

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
May 02, 2013 May 02, 2013

Copy link to clipboard

Copied

LATEST

Here is the basics, after the logo has been placed ...

activeDocument.suspendHistory('Logo Resize', 'main()');

function main(){

if(!documents.length) return;

/////////////////////////////// Amend to suit /////////////////////////////////

var Percent = 25; /* Resize logo to percentage of smallest side of doc */

var OffsetX = -10; /* Move logo10 pixels to the left */

var OffsetY = -10; /* Move 10 pixels up. */

var Opacity = 100; /* Opacity of logo */

/////////////////////////////////////////////////////////////////////////////////////////////

var startRulerUnits = app.preferences.rulerUnits;

app.preferences.rulerUnits = Units.PIXELS;

var myDoc = activeDocument;

var LB = myDoc.activeLayer.bounds;

var docHeight = myDoc.height;

var docWidth = myDoc.width;

var LHeight = Math.abs(LB[3].value) - Math.abs(LB[1].value);

var LWidth = Math.abs(LB[2].value) - Math.abs(LB[0].value);   

var percentageHeight = ((docHeight/LWidth)*Percent);

var percentageWidth = ((docWidth/LWidth)*Percent);

if(docWidth < docHeight){

myDoc.activeLayer.resize(percentageWidth,percentageWidth,AnchorPosition.MIDDLECENTER);

}else{  

  myDoc.activeLayer.resize(percentageHeight,percentageHeight,AnchorPosition.MIDDLECENTER);

  }

var LB = myDoc.activeLayer.bounds;

var X = docWidth - Math.abs(LB[2].value);

var Y = docHeight - Math.abs(LB[3].value);

X += OffsetX;

Y += OffsetY;

activeDocument.activeLayer.translate(X,Y);

activeDocument.activeLayer.opacity=Opacity;

app.preferences.rulerUnits = startRulerUnits;

}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 02, 2013 May 02, 2013

Copy link to clipboard

Copied

Layers can be any size and a layer may be a different size then its current size like a placed image that was scaled by Photoshop during the place operation so the image would fit within the canvas.  In fact all smart object layers have a transform associated with them the transform may be 100% is which case the layer would be its actual size.

So yes to do what you want would require a little scripting and you need better think a bit more about the process there are so mays thing possible. Like how you want to handle aspect ratio mismatches. Understand layer may have transparency may have been rotated some arbitrary amount so its bounds and its pixels will be different in size.  Now the script may not have to handle all possibilities if you know the layer will not contain transparency caused by rotation or edge area pixels being deleted.  You process may only need to handle a subset of what is possible if you know you will never  have some of the possibilities your process need not handle them for the will never exist in you environment.

In my Photo Collage Toolkit Scripts I resize placed images to at least fill the area they are to populate center it over that area and mask off any aspect ratio mismatch.  The scripts do not do any automated rotation and any transparence in place image was done for some reason by the user. Why they did this could only be guessed at by the scripts. So they do nothing for only the user know why. Your the user know what you have to handle.

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines