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

Creating A Square Crop...

Community Beginner ,
May 11, 2017 May 11, 2017

Copy link to clipboard

Copied

Hey Guys,

I have several hundred images that vary in dimensions as they have been cropped down by a photographer for their best 'look'. Some are supplied portrait and some are landscape. What I need to do is create a canvas size that is perfectly square for each image based on the longest length of each image so that nothing is cropped off. I will then fill in the background where needed. For instance, I may have an image that is 15" by 9" I will then create a canvas size that is a 15" by 15" square so that I don't crop anything off. I will then manually extended the background where short to give me a full 15" square image. Of course as I have said, not all of the images are supplied the same size. The dimensions will vary.

Does anyone know how I can create an Action or something that can batch run these images to give me perfect squares  based on the longest side? Any ideas would be most appreciated.

Thank you, Glenn

Views

1.5K

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

correct answers 1 Correct answer

Community Expert , May 11, 2017 May 11, 2017

That would be easy to script.  I do not believe a action even a conditional action could do that.  It would be simple to do with a Photoshop script. It could be a very simple script that only did that to a document.  You could record using the script in an action. Then batch that action perhaps using the Image Processor script.

You could try to do more in the action.  Perhaps try to create an action the would try to do a content aware fill of the added canvas area s..

Crafting Actions Package UPDA

...

Votes

Translate

Translate
Adobe
Community Expert ,
May 11, 2017 May 11, 2017

Copy link to clipboard

Copied

That would be easy to script.  I do not believe a action even a conditional action could do that.  It would be simple to do with a Photoshop script. It could be a very simple script that only did that to a document.  You could record using the script in an action. Then batch that action perhaps using the Image Processor script.

You could try to do more in the action.  Perhaps try to create an action the would try to do a content aware fill of the added canvas area s..

Crafting Actions Package UPDATED Aug 10, 2014 Added Conditional Action steps to Action Palette Tips.
Contains

Example
Download

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
Community Beginner ,
May 12, 2017 May 12, 2017

Copy link to clipboard

Copied

Thank you JJMack,

I am not that familiar with scripts and would not know how to write one to perform this function. Do you offer a service to do this?

Glenn

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 12, 2017 May 12, 2017

Copy link to clipboard

Copied

Actions can use scripts and script can use actions.  Actions are easy to record edit and debug.  Script are programs so you need to know something about programming.  If your mind can come up with the logic if my image is wider than it is high add canvas to the height to make the canvas as high as it is wide or if the image is higher than it is wide add canvas to the width to make the image as wide as it is high.  Then you know something about programming.  Now what you need to do is use a computer language so you computer will do you what you mind came up with.  There the rub and were users freak out.  The thing is they should not.   There are many computer languages and some are designed to be relatively easy to use and do not need to be elaborate or compiled into machine code.  Scripting language are goof example.   JavaScript  I use but actually do not know well is available on Mac and PC so it the best  scripting language to use for Photoshop Scripts.  Like Action have limits so does Adobe Photoshop scripting fot Adone Photoshop Document Object Model doe not cover all of Photoshop features.  However  anything the can be recorded or inserted into an action can be done in a script using Action Manager code.   Therefore Photoshop are Action on steroids your minds logic cam be included.

If you look at my crafting actions package you will see I included a dozen scripts I wrote to be use in actions a few are complex and quite powerful. The majority of the scripts are small simple and easy to read.   They are in the package so you can seen that scripting basic Photoshop thing is actually not hard or scary.  I have a programming background was a paid programmer I did not go to school to become a Programmer.  I was hired by big blue to fix their machines.  Five years into that job my manager  took my tool bag and said John you now a programmer.  That was scary. I remained a programmer for the next 35 years and was well paid  all all learning was on the job with sleepless nights.     I retired 15 yeas ago when Java was young I never had toe learn it and object orianent programming was also the new kid on the block.

Years ago there were no conditional Actions you could not tell if a document was a Landscape or a portrait in and action.  So one of the script I included in the crafting action package help a little in that area.   Conditional action are simple if condition is do this else do some other thing.   Only a few condition are supported all actions used in a conditional action need to be in the same action set they actions cam not be move to an other set and the set can not be renames.   IMO using a simple script step may  be better.

Here in one I include in the package RotatePortrait.jsx read the script it scary the my script in more complex then it need to be actually a one liner would work if your Photoshop  ruler units are set to something other that percent for when set to percent width is 100% and height is 100%  comparing Height to width would compare equal.  

"if (activeDocument.height > activeDocument.width) activeDocument.rotateCanvas(90);"

/*

<javascriptresource>

<about>$$$/JavaScripts/RotatePortrait/About=JJMack's Rotate Portrait.^r^rCopyright 2009 Mouseprints.^r^rScript utility for action.^rNOTE:Rotate Portrait to Landscape!</about>

<category>JJMack's Action Utility</category>

</javascriptresource>

*/

Rotate();

function Rotate() {

// validate that a document is open

if (documents.length < 1) {

  alert("No Open Document!");

  return;

  }

var orig_ruler_units = app.preferences.rulerUnits;

app.preferences.rulerUnits = Units.PIXELS;

// Rotate portrait to landscape orientation

if (activeDocument.height > activeDocument.width) activeDocument.rotateCanvas(90);

// Reset units to original settings

app.preferences.rulerUnits = orig_ruler_units;

}

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
Community Beginner ,
May 12, 2017 May 12, 2017

Copy link to clipboard

Copied

LATEST

Hey JJMack,

I really do appreciate the effort you put into your reply. Unfortunately for me, I don't have the aptitude for programming and for that reason I got into something artistic! Bill Gates or Steve Jobs I am not! I did find someone that will write the script for me. Far less stressful and time consuming for me! Thank you. Take care.

Glenn

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