Copy link to clipboard
Copied
Hi there
I have searched all I could (community, chat GPT), etc to find an answer but it seems there is no such feature? Can it be?
I have an active selection, moving around zooming in, etc. How do I fit the screen so that all selected areas are visible and fill the screen? When adjusting the selection on a portion of an image, it would be helpful to be able to zoom out again to the entire selection.
Maybe I just missed it somehow. Thanks for the help.
Copy link to clipboard
Copied
Just so you know, ChatGPT and Gemini are often wrong - don't rely on them for answers. You have all of the commands under the veiw menu, do none of them work for you?
Copy link to clipboard
Copied
Thank you for your hint, you are right: I was advised to use CMD+0 by ChatGPT but this just zooms out to the Canvas. Select a rectangle in any project and try and Zoom to it. I was not able to find a solution. The one that gets closest is "fit layer on screen", but then this applies to a layer, not a selection.
Copy link to clipboard
Copied
I use a trackpad, zooming in and out is something I don't have to think about and is automatic with pinching. With a mouse, I prefer the keyboard shortcut using the spacebar + cmd/ctrl and clicking and dragging - you can also set up a scroll wheel - it's in the preferences.
Copy link to clipboard
Copied
I’ll create a script for you to zoom to the selection. I'll post back later when I have time to look at this.
Copy link to clipboard
Copied
Photoshop recently added the View > Fit Layer(s) on Screen command and its keyboard shortcut, which may cover at least some of your situations. If what is selected (in the Layers panel) are one or more type or shape layers, or pixel layers with transparent areas, then you can already zoom any of those to fit the window. And another shortcut for that is to Option/Alt-click the layer in the Layers panel.
What that command doesn’t cover is fitting a marquee (pixel) selection to the window. Hopefully Stephen Marsh’s script will take care of that.
Copy link to clipboard
Copied
The following script leverages the fit layers on screen command, offering a single history state.
/*
Zoom to Selection Bounds.jsx
v1.0, 1st April 2024, Stephen Marsh
https://community.adobe.com/t5/photoshop-ecosystem-discussions/fit-selection-to-screen-or-zoom-to-selection/td-p/14526195
*/
app.activeDocument.suspendHistory("Zoom to Selection", "main()");
function main() {
var selectionBounds = null;
try {
selectionBounds = app.activeDocument.selection.bounds;
if (selectionBounds) {
executeAction(stringIDToTypeID("copyMerged"), undefined, DialogModes.NO);
pasteInPlace();
reselect();
fitLayersOnScreen();
app.activeDocument.activeLayer.remove();
} else {
// There should be a selection active to zoom to the selection!
}
} catch (e) {
alert("Error!" + "\r" + e + ' on line: ' + e.line);
}
}
function pasteInPlace() {
function s2t(s) {
return app.stringIDToTypeID(s);
}
var descriptor = new ActionDescriptor();
descriptor.putBoolean(s2t("inPlace"), true);
descriptor.putEnumerated(s2t("antiAlias"), s2t("antiAliasType"), s2t("antiAliasNone"));
descriptor.putClass(s2t("as"), s2t("pixel"));
executeAction(s2t("paste"), descriptor, DialogModes.NO);
}
function fitLayersOnScreen() {
function s2t(s) {
return app.stringIDToTypeID(s);
}
var descriptor = new ActionDescriptor();
var reference = new ActionReference();
reference.putEnumerated(s2t("menuItemClass"), s2t("menuItemType"), s2t("fitLayersOnScreen"));
descriptor.putReference(s2t("null"), reference);
executeAction(s2t("select"), descriptor, DialogModes.NO);
}
function reselect() {
function s2t(s) {
return app.stringIDToTypeID(s);
}
var descriptor = new ActionDescriptor();
var reference = new ActionReference();
reference.putProperty( s2t( "channel" ), s2t( "selection" ));
descriptor.putReference( s2t( "null" ), reference );
descriptor.putEnumerated( s2t( "to" ), s2t( "ordinal" ), s2t( "previous" ));
executeAction( s2t( "set" ), descriptor, DialogModes.NO );
}
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html
Copy link to clipboard
Copied
Thanks to you all! I am really overwhelmed by your support! Many great thanks Stephen for the script. I will study how to install scripts and try it out shortly.
Copy link to clipboard
Copied
Stephen are you sure that after we install your script and activate it, the screen won't dissolve and says APRILS FOOL! I have been searching the forum for such a jest, and am disappointed that I haven't found one so far. 😉
Copy link to clipboard
Copied
Stephen are you sure that after we install your script and activate it, the screen won't dissolve and says APRILS FOOL! I have been searching the forum for such a jest, and am disappointed that I haven't found one so far. 😉
By @Trevor.Dennis
Unfortunately, the doctors had to remove my sense of humour due to an unfortunate mishap.
Copy link to clipboard
Copied
Do you use the spring loaded H key shortcut? Simply hold down the H key (no modifier) and the screen zoom out to 'fit Image' with a rectangle showing the current zoom size. You move the rectangle with the mouse, and when you release the H key, it will zoom to the new loaction at the previous zoom ratio. It's not exactly what you describe, but might be a workaround for you. I know I love it and use it all the time.