Skip to main content
September 15, 2011
Answered

Help! Resizing different documents with different resolutions?

  • September 15, 2011
  • 1 reply
  • 1818 views

Hello!

Please help me with my situation:

I was trying to make an action that will decrease 1 inch to all sides of my document (the document size was 12x36 inches) and hopefully to other documents.  I don't want to crop the image, I just want to resize the whole image to 10x24 inches, leaving a 1 inch transparent border (the gray and white checkerboard) to my document. I started resizing manually, but it was time-consuming so I tried to make the action I stated above. I was expecting that it would decrease a proportionate 1 inch to the top, bottom, left and right sides of other documents, but it didn't. Any procedure to make this happen in different documents with different sizes and resolutions?

PS: All the the documents that I will resize would eventually be printed ( I don't know if this would help).

Thank you for your help!

This topic has been closed for replies.
Correct answer JJMack

Thanks for all the info! One last thing I want to ask: I have downloaded your package and I want to ask what specific file do I need to execute to retrieve the dimensions of my image so that I can build up my action with the help of your script.

Again, thanks alot!


Read the Action Enhanced via Scripted Photoshop Functions.txt file it tell you the function each script perform.  Most script will retrive things like Width and Hieght thay are used all the time. Look at the file size of the JSX file. Read some of the small ones there not much too them the small ones should be easy toread and understand.  orient.jsx and  RotatePortrait.jsx  will for sure get width and height and SaveAndRestoreResolution.jsx will get the resolution.

var orig_ruler_units = app.preferences.rulerUnits;

app.preferences.rulerUnits = Units.PIXELS;

//get height and width in pixels

var width = app.activeDocument.width;

var height = app.activeDocument.height;

var res = app.activeDocument.resolution;

1 reply

JJMack
Community Expert
Community Expert
September 15, 2011

Kursover wrote:

I was trying to make an action that will decrease 1 inch to all sides of my document (the document size was 12x36 inches) and hopefully to other documents. I don't want to crop the image, I just want to resize the whole image to 10x24 inches, leaving a 1 inch transparent border (the gray and white checkerboard) to my document. I was expecting that it would decrease a proportionate 1 inch to the top, bottom, left and right sides of another document, but it didn't. Any procedure to make this happen in different documents with different sizes and resolutions?

Easy to do in a script not so easy in an action unless you know that there is no background layer or that all have backgounds.  You can not add transparent canvas to a document with a background layer for brckground layers do not support transparence. Documents may or mant not have a background layer and background layers can be converted to a normal layer.  Actions can not use logic without using a script to see if there is a background.  My Crafting Actions package contains a utility script for actions that will convert background layers to a normal layer should a document have a background layer. Once you know there is no "Background" the rest is easy to do in an action with menu limage canvas size check relative and set width and height to 1" the will add 1"

Decreasing -1" will CROP any layer the has not transparent pixels in the outter 1"

Crafting Actions Package
Contains

  • Action Actions Palette Tips.txt
  • Action Creation Guidelines.txt
  • Action Dealing with Image Size.txt
  • Action Enhanced via Scripted Photoshop Functions.txt
  • CraftedActions.atn Sample Action set includes an example Watermarking action
  • Sample Actions.txt Photoshop CraftedActions set saved as a text file.
A script can retrieve the width and height of a document to changs size you need to resize the document this will not crop but will resample and you most matain aspect ratio elss resize will distort. Decreasing canvas size may crop...
  • 12 Scripts for actions

Example

Download

JJMack
September 15, 2011

Thank you for your fast reply!

Oh, ok. My documents are already merged so when I open one of them, the background layer would be my only layer and no other layer is present in that document. I will then change the background layer to a normal layer(the lock would then be gone, and the name would change to "Layer 0") and then I would resize "Layer 0", decreasing 1 inch each side, and the gray and white checkerboard will appear. When I use the Canvas size, it will add 1 inch to my document, but I want to retain the original document size and only resize the Background Layer / "Layer 0" / Image without cropping it.

JJMack
Community Expert
Community Expert
September 15, 2011

What you describe is not an image resize but a transform of a layer which resamples the layer decreasing or increaseing the number of pixel in the layer. In your case decreasing and only covers part of the canvas.  Photoshop supports and size layer  they can be larger, smaler and the same saze as canvas size. So the canvas size of you document remains the same so many width pixels and so many height pixels.  Layer 0 does not cover the canvas it less then canvas size now.  The document is sill the same size.  Only some file formats support transparency like PNG and psd.  If you save your document it will still have the same canvas width and hieght any the transparent pixels will be filled in if you save to jpeg for example.

So what you want to do is covert the Background layer to layer 0 normal layer the use free transform to resize layer 0 smaler then canvas size. That will resample your layer 0 pixels to a smaler number of pixels. Convert Layer 0 to a smart object before you transform it...

If you transform and decrease 1" on all sides then may well distort you image.  you want to constrain the transform or image resize so the image is not distorted. only square image 1:1 aspect ratios images will reduce or increase the same amount on all sides.

JJMack