Highlighted

Script for: Batch Import, Place, Crop Remainder of Canvas, Save As

Community Beginner ,
Nov 19, 2020

Copy link to clipboard

Copied

Hello, I am looking to do the following:

 

1. Import a batch of photos

2. Place said photos (one by one) onto a 300x300 canvas, centered

3. Crop remainder of the canvas

  • so if portrait orientation, crop Left/Right of remaining canvas pixels
  • if landscape orientation, crop Top/Bottom of remaining canvas pixels

4. Save image to a designated folder

5. Repeat for each image in a batch import.

 

Thanks in advance.

Adobe Community Professional
Correct answer by Stephen_A_Marsh | Adobe Community Professional

That's what FIle > Automate > Fit Image is for. Just record an action using the Fit Image command and enter 300px for both the width and depth of the resized image. This will be recorded. When batch played using Batch or Image Processor running the action, the longest width or depth edge will be resized to 300px and the other shorter edge will be proportionally resized smaller.

 

With reflection, I don't think that there is any need to record the trim command.

TOPICS
Actions and scripting, How to, Import and export, Windows

Views

75

Likes

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

Script for: Batch Import, Place, Crop Remainder of Canvas, Save As

Community Beginner ,
Nov 19, 2020

Copy link to clipboard

Copied

Hello, I am looking to do the following:

 

1. Import a batch of photos

2. Place said photos (one by one) onto a 300x300 canvas, centered

3. Crop remainder of the canvas

  • so if portrait orientation, crop Left/Right of remaining canvas pixels
  • if landscape orientation, crop Top/Bottom of remaining canvas pixels

4. Save image to a designated folder

5. Repeat for each image in a batch import.

 

Thanks in advance.

Adobe Community Professional
Correct answer by Stephen_A_Marsh | Adobe Community Professional

That's what FIle > Automate > Fit Image is for. Just record an action using the Fit Image command and enter 300px for both the width and depth of the resized image. This will be recorded. When batch played using Batch or Image Processor running the action, the longest width or depth edge will be resized to 300px and the other shorter edge will be proportionally resized smaller.

 

With reflection, I don't think that there is any need to record the trim command.

TOPICS
Actions and scripting, How to, Import and export, Windows

Views

76

Likes

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
Nov 19, 2020 0
Most Valuable Participant ,
Nov 19, 2020

Copy link to clipboard

Copied

Free Download  The Image file scans be Placed into your template's 300x300px image area space. Any excess image area will be masked off. the result will look like a centered 1:1 Aspect Ratio crop.

JJMack

Likes

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
Reply
Loading...
Nov 19, 2020 1
Adobe Community Professional ,
Nov 19, 2020

Copy link to clipboard

Copied

You should be able to do this with an action using Fit Image and Trim commands (perhaps adding a conditional action if you have a mix of flattened and layered images), then run the action via Batch, Image Processor or Image Processor Pro. 

Likes

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
Reply
Loading...
Nov 19, 2020 2
Community Beginner ,
Nov 19, 2020

Copy link to clipboard

Copied

Thanks for your help. Do you mind walking this dummy through it step by step?

I've been trying to implement your answer for about 15 min now and seem to be stuck.

Likes

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
Reply
Loading...
Nov 19, 2020 0
Adobe Community Professional ,
Nov 19, 2020

Copy link to clipboard

Copied

Why place?

 

Are all files flattened?

 

What file format are you saving to?

Likes

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
Reply
Loading...
Nov 19, 2020 0
Community Beginner ,
Nov 19, 2020

Copy link to clipboard

Copied

Place, because pic dimensions vary.

 

All files flattened.

 

Saving to JPEG, high quality.

 

 

Likes

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
Reply
Loading...
Nov 19, 2020 0
Adobe Community Professional ,
Nov 19, 2020

Copy link to clipboard

Copied

If you expect all files to fit into hight oe width with two sides that has extra white space that can be done using Trim command. We have unknown facts like smalest file dimensions to provide you with easiest siolution.

 

Another possibility is to use Data Driven graphics wit Fit or Fill option for Pixel variable. You must create data sets and to rename your files what is easy in Bridge. Here is official guide for data driven graphics, if you need more help search internet https://helpx.adobe.com/photoshop/using/creating-data-driven-graphics.html With data driven graphics that process must be two step process: to export data sets, actualy PSD files with images placed and fitted and then to run batch to remove white space.

Likes

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
Reply
Loading...
Nov 19, 2020 1
Community Beginner ,
Nov 19, 2020

Copy link to clipboard

Copied

Yes, so currently what I do is the following:

 

1. I have a blank 300x300px canvas

2. I drag a photo from a folder into this Photoshop canvas, and it automatically fits the image down to size

3. I then run Trim to remove the extra white space

4. Save As JPEG High Quality

5. Repeat

 

I guess I am stuck at automating the #2 above.

 

Likes

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
Reply
Loading...
Nov 19, 2020 0
Adobe Community Professional ,
Nov 20, 2020

Copy link to clipboard

Copied

That's what FIle > Automate > Fit Image is for. Just record an action using the Fit Image command and enter 300px for both the width and depth of the resized image. This will be recorded. When batch played using Batch or Image Processor running the action, the longest width or depth edge will be resized to 300px and the other shorter edge will be proportionally resized smaller.

 

With reflection, I don't think that there is any need to record the trim command.

Likes

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
Reply
Loading...
Nov 20, 2020 2
Community Beginner ,
Nov 20, 2020

Copy link to clipboard

Copied

Success.

 

Many thanks ya'll!

Likes

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
Reply
Loading...
Nov 20, 2020 0
Adobe Community Professional ,
Nov 19, 2020

Copy link to clipboard

Copied

What are dimensions of your images that you want to place? Always the same or not? Images to be placed exceed canvas dimensions or not? Are you aware of Photoshop features and optional configurations in Preferences regarding Place commands? Things can be done in a few different ways, by the way. I am asking you to check your awarness for case to record action(s) which are probably possible but task is not that straight forward.

Likes

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
Reply
Loading...
Nov 19, 2020 1
Community Beginner ,
Nov 19, 2020

Copy link to clipboard

Copied

Dimensions vary. But all have at least one side bigger than 300px.

 

Images exceed canvas almost always.

 

 

Likes

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
Reply
Loading...
Nov 19, 2020 0
Adobe Community Professional ,
Nov 20, 2020

Copy link to clipboard

Copied

Then you must run Fit Image in this process. My idea to record action is following with guess that you have flatt images which you are trying to place.

 

Record action and run it using Image Processor Pro, for example:

  • Fit Image into 300x300px.
  • Select All > Copy
  • Switch to previous tab (while recording action ensure that previous tab contains Image or canvas 300x300px)
  • Paste copied content
  • Use Trim from Image menu to trim top left pixel color which should be in any case white or canvas visible.
  • Select All > Copy
  • Undo last operation of Trim
  • Delete top layer which contains pasted image
  • Switch to next tab
  • Paste copied content
  • Use Image > Reveal All

 

Note: I am not checking action while writing, I am writing steps from my head so mistake are possible.

 

Update: I have overlooked some things in this request. Use @Stephen_A_Marsh suggestion and ignore my complex action recording which is not necessary.

Likes

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
Reply
Loading...
Nov 20, 2020 1
JJMack LATEST
Most Valuable Participant ,
Nov 20, 2020

Copy link to clipboard

Copied

It make no difference what size you image are if a center 1:1 Aspect ratio crop is all you need and you do not care if  a centered 1:1 Aspect Ration corp produces an acceptable Image composition. 

 

Most will not find that acceptable.  Image composition is important. It is not possible to crop all images to a 1:1 aspec ratio and produce an acceptable image composition. 

 

If your Images have vastly different Aspect ration than square.   A  very wide Panorama will lose to much image content on the sides and a very tall Portrait crop of the Empire State Building will make the building less than a sky scrapper croped 1:1. 

 

If You use  a fit image resize the Panorama will remain a panorama after the resize and the skyscraper will remain a skyscraper however most of your 1:1 Aspect  Ratio image ares will be empty.  The skyscraper will have empty canvas on both sides and the Panorama will have empty canvas top and bottom.   

 

If your image have more normal aspect ratios like a 3:2 Landscape and 2:3 Portrait aspect ratio  A Center 1:1 Crop will often work well. If  the Image subject matter is not tightly cropped by the existing 3:2 or 2:3 aspect ratio.   If you use a zoom lens and carefully frame the your subject while taking Pictures there will be no room for cropping  you need to preserve your 3:2 and 2:3 image aspect ratio.  

 

Normally snapshot images are not well composed and centered 1:1  crops will usually be acceptable. Some will not subject matter may not work well in a 1:1 aspect ratio image.

 

My script by  default will create virtual center populating your images. Some of the script have options the have it use fit image resize instead some have an option to rotate image for best fit.  While you can do a lot with Photoshop Actions  you can do much more using Photoshop scripting.  But you need the be a Programmer to create custom scripts.    However, it is very easy to create  your own custom template you can use with script provided by others  and have your image populated  into your custom template.

 

While the Template Adobe offer  are designed to be manually populate and tweaked  for your final composition.  You can usually modify them so they can be batch populated for a single output customization.  You can tweak the output with Photoshop  if you save output PSD files.  

 

IMO you should stop trying to reinvent the wheel.  Use existing wheel technology Design your own custom chariot template.

 

 

JJMack

Likes

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
Reply
Loading...
Nov 20, 2020 0