Skip to main content
Participant
September 29, 2023
Open for Voting

Auto image pixel dimensions check box on export

  • September 29, 2023
  • 2 replies
  • 174 views

In the "save for web" dialogue box, can you add a check box to add the pixel dimensions to the end of the file name? That would be really concenient in 2 ways: I don't have to add the size and I can check to make sure my file is the correct size.

2 replies

Stephen Marsh
Community Expert
Community Expert
September 30, 2023

The following script will append the canvas dimensions as a suffix to the filename via the standard interactive Save for Web (Legacy) interface:

 

/*
Add Pixel Dimensions to Save for Web Filename.jsx
https://community.adobe.com/t5/photoshop-ecosystem-ideas/auto-image-pixel-dimensions-check-box-on-export/idc-p/14123146
v1.0 - 30th September 2023, Stephen Marsh
*/

#target photoshop

// Add a new script item in the 'File > Export' menu to separate the script from the normal 'File > Scripts' folder
/*
<javascriptresource>
<name>$$$/JavaScripts/SaveforWebCustomName/Menu=Save for Web Custom Name...</name>
<menu>export</menu>
</javascriptresource>
*/

/*
var origRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var docWidth = activeDocument.width.value;
var docHeight = activeDocument.height.value;
app.preferences.rulerUnits = origRulerUnits;
*/
var docWidth = activeDocument.width.as('px');
var docHeight = activeDocument.height.as('px');
var docName = activeDocument.name.replace(/\.[^\.]+$/, '');
docName = docName + "_" + docWidth + "x" + docHeight + "px";
activeDocument.duplicate(docName, false);
app.runMenuItem(stringIDToTypeID( "saveForWeb" ));
activeDocument.close(SaveOptions.DONOTSAVECHANGES);

 

Info on saving and using scripts here:

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

 

Once installed, the script will be in the File > Export menu as "Save for Web Custom Name..." and then you could use Edit > Keyboard shortcuts to both hide the default menu item for Save for Web (Legacy) and then apply the same keyboard shortcut to the installed script.

Stephen Marsh
Community Expert
Community Expert
September 30, 2023

@Arnold32613444zacy 

 

I have added my vote, but I doubt that new features will be added to Save for Web (Legacy), bug fixes – hopefully yes! But there is no reason that this couldn't be added to Export As or Quick Export Preferences.

 

This could be scripted for Save for Web (Legacy).

 

How do you use Save for Web (Legacy)? Do you need flexibility in previewing, changing format and quality settings etc? Or do you always tend to use a limited set of formats and quality options and don't require an interactive interface?