Copy link to clipboard
Copied
Is it possible to make an action that resizes canvas size of a specific file and saves as the resized file.
What do I mean?
Say I create a logo 720x640 and now I need that same logo in 40+ different sizes, what I normally do is resize the original logo and save as a new file with the name of the new logo size.
I was wondering if it's possible to create an action that does that automatically and all that's left for me to do is open those files and change the design layout.
Copy link to clipboard
Copied
40 may be a prorblem but have you looked into generating image assets?
https://helpx.adobe.com/photoshop/using/generate-assets-layers.html
Otherwise please provide a more detailled description of the process – target locatiosn, naming conventions, …
Ultimately a Script might be the best approach.
Copy link to clipboard
Copied
Great idea! An action or script should be able to rename the layers to produce the required files for future images.
Copy link to clipboard
Copied
Will the 40+ different sizes always be the same?
A "fast" way that you can do this without custom scripting is by creating an action that includes a recorded save step via the Image Processor Pro script to create unique sequentially numbered files, then use Adobe Bridge to batch rename.
Here is a screenshot of the action, only two sizes in this example:
The IPP settings recorded into the action:
And here is the Batch Rename:
Copy link to clipboard
Copied
The sizes are MOSTLY the same, sometimes you use less sometimes more of the sizes.
from my understanding creating an action for all 40 sizes and then using this action for only 20 of those isn't possible?
The naming system is "000x000_GameName_EN"
so the only thing changing is the size in the name, the rest are all called the same.
Copy link to clipboard
Copied
A Scripts can resize logo file for different image sizes. Even a Raster logo will scale down well in size and Display and print well on the image the are placed on. Photoshop script "PlaceLogo.jsx" modifying it to use you logo and to resize to you preference and location should be easy.
So Create a large logo image and use it for all you images sizes. Resize your logo for the image size do not resize your image for your logo size.
/* ==========================================================
// 2021 John J. McAssey (JJMack)
// ======================================================= */
// This script is supplied as is. It is provided as freeware.
// The author accepts no liability for any problems arising from its use.
/*
<javascriptresource>
<about>$$$/JavaScripts/PlaceLogo/About=JJMack's PlaceLogo ^r^rCopyright 2021 Mouseprints.net^r^rPhotoshop Script^rCustomize using first four var</about>
<category>JJMack's Script</category>
<enableinfo>true</enableinfo>
</javascriptresource>
*/
#target photoshop;
app.bringToFront();
var logoFile = "~/Desktop/JJMack.png"; // Logo Image file should be large for resize down works better than up. Vector files can be any size.
var LogoSize = 10; // percent of document height to resize Logo to
var LogoMargin = 1; // percent of Document height the Logo should have as a margin
var LogoLocation = 9; // Like a tick tack toe board 1 through 9. 1=Top Left 9=Bottom Right
var LogoRotation = -20; // Center Logo Location 5 can be Rotated -90 through +90 degrees + degree Clockwise - CounterClockwise
app.displayDialogs = DialogModes.NO; // Dialog off
var strtRulerUnits = app.preferences.rulerUnits; // Save Users ruler units
var strtTypeUnits = app.preferences.typeUnits; // Save Users Type units
app.preferences.rulerUnits = Units.PIXELS; // work with pixels
app.preferences.typeUnits = TypeUnits.PIXELS; // work with pixels
//placeLogo(logoFile, LogoSize, LogoMargin, LogoLocation, LogoRotation); // Place Logo into the location 5 would be Document's center
if (documents.length) app.activeDocument.suspendHistory('placeLogo','placeLogo(logoFile,LogoSize,LogoMargin, LogoLocation, LogoRotation)' );
app.preferences.rulerUnits = strtRulerUnits; // Restore user ruler units
app.preferences.typeUnits = strtTypeUnits; // Restore user type units
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function placeLogo(Image,Size,Margin,position,angle){
if(!documents.length) return; // if no document return
var fileObj = new File(Image); // the passed file
if(!fileObj.exists){ // If file does not exits tell user
alert(fileObj.name + " does not exist!"); // Alert User
return; // return
}
try{
var doc = app.activeDocument; // set Doc object to active document
var layers = app.activeDocument.layers; // get layers
app.activeDocument.activeLayer = layers[0]; // Target Top Layer
placeFile(fileObj); // Place in file the Logo File
activeDocument.activeLayer.resize(100 ,100,AnchorPosition.MIDDLECENTER); // Insure Place did not scale layer
var SB = activeDocument.activeLayer.bounds; // get layers bounds
var layerHeight = SB[3] - SB[1]; // get layers height
var resizePercent = (100/layerHeight)*(Size/100*doc.height.value); // Percent to resize by
activeDocument.activeLayer.resize(resizePercent ,resizePercent,AnchorPosition.MIDDLECENTER); // Resize width and height by percentage
marginSize = Margin/100*doc.height.value; // Margin size
var selectedRegion = Array(Array(0+marginSize,0+marginSize), Array(doc.width-marginSize,0+marginSize), Array(doc.width-marginSize,doc.height-marginSize), Array(0+marginSize,doc.height-marginSize));
activeDocument.selection.select(selectedRegion); // Select document area for the logo Positioning
switch (position){ // Align resized logo smart object layer into position
case 1 : align('AdLf'); align('AdTp'); break;
case 2 : align('AdCH'); align('AdTp'); break;
case 3 : align('AdRg'); align('AdTp'); break;
case 4 : align('AdLf'); align('AdCV'); break;
case 5 : align('AdCH'); align('AdCV'); activeDocument.selection.deselect(); activeDocument.activeLayer.rotate(angle); break;
case 6 : align('AdRg'); align('AdCV'); break;
case 7 : align('AdLf'); align('AdBt'); break;
case 8 : align('AdCH'); align('AdBt'); break;
case 9 : align('AdRg'); align('AdBt'); break;
default : break;
}
app.activeDocument.selection.deselect(); // deselect
}
catch(e) { alert(e + ': on line ' + e.line); } // inform user of error
finally{ }
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function placeFile(placeFile) {
var desc21 = new ActionDescriptor();
desc21.putPath( charIDToTypeID('null'), new File(placeFile) );
desc21.putEnumerated( charIDToTypeID('FTcs'), charIDToTypeID('QCSt'), charIDToTypeID('Qcsa') );
var desc22 = new ActionDescriptor();
desc22.putUnitDouble( charIDToTypeID('Hrzn'), charIDToTypeID('#Pxl'), 0.000000 );
desc22.putUnitDouble( charIDToTypeID('Vrtc'), charIDToTypeID('#Pxl'), 0.000000 );
desc21.putObject( charIDToTypeID('Ofst'), charIDToTypeID('Ofst'), desc22 );
executeAction( charIDToTypeID('Plc '), desc21, DialogModes.NO );
}
function align(method) {
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID( "Lyr " ), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
desc.putReference( charIDToTypeID( "null" ), ref );
desc.putEnumerated( charIDToTypeID( "Usng" ), charIDToTypeID( "ADSt" ), charIDToTypeID( method ) );
try{
executeAction( charIDToTypeID( "Algn" ), desc, DialogModes.NO );
}catch(e){}
}
Copy link to clipboard
Copied
Sure it is possible, but not easy or elegant if all 40 resizes are in a single action. You would simply untick the related "groups" of steps that are not required, which is not great.
What would be better is to make each related groups of action step into a different action per set. Another action can then be used to record playing each resize action. Then you can simply untick more easily. There may be a script to help play varying actions.
In the above example, action set 2 will not be run as it is unticked.
Even with scripting, you will need a way to enable/disable various resizes, either by code, GUI, list or other method to select the required sizes.
Otherwise just run them all and delete the logo sizes that you don't want if that is quicker than having to select variable sizes.
A simple way to create an action "run list" in JavaScript below:
app.doAction("1000px wide","My Resize Set");
app.doAction("800px wide","My Resize Set");
//app.doAction("600px wide","My Resize Set");
app.doAction("450px wide","My Resize Set");
The code above has four resize actions to run, however I have disabled one by commenting it out // so that the 600px wide action is ignored and only three actions are played by the script.
Copy link to clipboard
Copied
You should also look into Generator/Image Assets as linked by @c.pfaffenbichler
Copy link to clipboard
Copied
So where did you end up with this project?