Photoshop CS6: Custom zoom percentage

A tutorial on how to set custom zoom levels and binding them to keyboard shortcuts in Photoshop CS6



You might find yourself zooming in and out a lot between editing cycles, to view the changes you've done to a photograph etc. Zooming out is easily done using standard shortcuts, but zooming back in to your favored percentage (which for some people is a specific/arbitrary value) is a different story. Now if you do retouching for a living and needs to zoom in and out many times a day, zooming back into your preferred level becomes a genuine issue. So here is a step by step tutorial on how to make a keyboard shortcut (or action preset) that will hit your favorite zoom level every time.

The preset can be altered and duplicated to provide a palette of custom zoom levels right at your fingertips.

NOTE: The zoom level is calculated relative to image resolution. Although this example is aimed at Windows users it should be easily applied to Mac as well.


Step 1: Creating the script

• Create a new empty text file and paste the code below into it while changing the percentage value "225" in the "setZoomLevel(225)" function call to your preference eg. a value of 89.5 will zoom to 89.5% (see the comments in the code)
• Change the name of the file to have the ".jsx" file extension (exampe: favorite-zoom-level.jsx)

Script code (copy all the text in orange color):
main();
function main(){

// Change the value between the parentheses below
// into your desired percentage:
setZoomLevel(225);

// Leave the code below unchanged
function setZoomLevel(zoom){
if(zoom < 1) zoom =1;
var ref = new ActionReference();
ref.putEnumerated(charIDToTypeID("capp"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
var getScreenResolution = executeActionGet(ref).getObjectValue(stringIDToTypeID('unitsPrefs')).getUnitDoubleValue(stringIDToTypeID('newDocPresetScreenResolution'))/72;
var docResolution = activeDocument.resolution;
activeDocument.resizeImage(undefined, undefined, getScreenResolution/(zoom/100), ResampleMethod.NONE);
var desc = new ActionDescriptor();
ref = null;
ref = new ActionReference();
ref.putEnumerated(charIDToTypeID("Mn  "), charIDToTypeID("MnIt"), charIDToTypeID('PrnS'));
desc.putReference(charIDToTypeID("null"), ref);
executeAction(charIDToTypeID("slct"), desc, DialogModes.NO);
activeDocument.resizeImage(undefined, undefined, docResolution, ResampleMethod.NONE);};};

Step 2: Adding the script to Photoshop

• Close Photoshop
• Copy the script file into the Photoshop scripts folder: "C:\Program Files\Adobe\Adobe Photoshop CS6 (64 Bit)\Presets\Scripts\" (it might be a different path depending on your version)
• Start Photoshop and verify that the script appears in the Scripts menu (File -> Scripts)


Step 3: Assigning the script to a keyboard shortcut

• Open the Actions panel and create a new action, name it to your liking and select a shortcut key.
• While recording select "Insert Menu Item" from the fly-out menu (a popup will appear)
• While the popup is displayed Photoshop will wait for you to choose a menu item: Go to the Scripts menu (File -> Scripts) and select the newly created script.
• Stop recording, that's it.


I hope you found the information useful :)

Best regards
Lars Brandt Stisen, MADDOCMAN BERLIN
http://www.maddocman.com

Follow me on Behance:
http://www.behance.net/maddocman


Product photography: Magazine ad for Hoptimist Denmark

The picture we created for the Hoptimist magazine ad  - Click to Zoom

Photographing a new range of Hoptimist products for the "by Hoptimist" bowls advertising campaign. Creative direction: Mette Beate, Photography and post-production by Lars Brandt Stisen and Mette Beate, Studio: MADDOCMAN Berlin.

View more of our work on Behance:

Read more about our Berlin based imaging studio at: