Copy link to clipboard
Copied
When I was previously very active in PS, a few versions back under Win 7, Fit on Screen did not literally fill the screen, which I liked much better.
I feel there's three downsides to the current one...
(1) You always have a sense there just might be more of your picture past the boundaries of your viewport. I tend to wanna make sure there isn't.
(2) It can be finicky to start drawing a crop or marquee at one of the corners (possibly also depending if you have the "magnetic" options active or not).
(3) To me, it just doesn't look as neat or reassuring.
Upside: It now does what it says (very literally).
I just noticed that the behavior of which I'm speaking is still available in the toolbar of the Hand Tool, but this one doesn't seem to record to an action.
I could probably record the current behavior and add a "zoom down" step, but depending on size this can often create too much of a border.
Now if a script can read/write to the zoom percentage field, I can simply Fit on Screen, then deduct 2 or 3% from the zoom percentage.
Or does Adobe happen to have a script for the current behavior I like on the Hand toolbar...? An option in Preferences would be nice too.
This is the one I like, but I never use the Hand Tool... As you can see, it creates a handy margin, whereas the recordable one from the menu takes up all available space.
Try this mashup. You may only need line 2?
Change the - 2 for + 2 to enlarge 2% or whatever the desired value is:
// Fit on screen
app.runMenuItem(stringIDToTypeID('fitOnScreen'));
// Round to integer
var roundedZoom = parseInt(getActiveDocumentZoom());
// Reduce magnification -2%
setZoom(roundedZoom - 2);
// From mike hale
function getActiveDocumentZoom(){
var ref;
ref = new ActionReference();
ref.putProperty( charIDToTypeID( "Prpr" ),charIDToTypeID('Zm '));
ref.putEnumerated(
...
Copy link to clipboard
Copied
I am not sure I understand, Fit on Screen does not result in the image »touching« the screen’s edges for me.
Could you please post a COMPLETE screenshot of before and after applying View > Fit on Screen?
As for Scripting there is one from a previous long-time contributer that might meet your intentions:
// by mike hale;
#target photoshop
alert (getActiveDocumentZoom());
function getActiveDocumentZoom(){
var ref;
ref = new ActionReference();
ref.putProperty( charIDToTypeID( "Prpr" ),charIDToTypeID('Zm '));
ref.putEnumerated(charIDToTypeID('Dcmn'), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
return (executeActionGet(ref).getUnitDoubleValue (charIDToTypeID('Zm ')))*100;
};
function setZoomToNearestStandardZoom( zoomPercent ){
var currentZoom;
currentZoom = getActiveDocumentZoom();
while( currentZoom > zoomPercent ){
app.runMenuItem(charIDToTypeID('ZmOt'));
currentZoom = getActiveDocumentZoom();
}
while( currentZoom < zoomPercent ){
app.runMenuItem(charIDToTypeID('ZmIn'));
currentZoom = getActiveDocumentZoom();
}
}
setZoomToNearestStandardZoom(50);
Copy link to clipboard
Copied
"Fit on Screen does not result in the image »touching« the screen’s edges for me."
Interesting... Lucky you 🙂 Yeah, who knows what may be involved...
This is how I want it. I can only get it by clicking in the Hand Tool toolbar.
When pressing Ctrl+0 or using the Menu item, I get this (I understand if some prefer it, but not me...)
-
Wow, thanks for the script! I was too lazy too look as I thought that field would not be accessible.
P.S.: I'm in PS 23.3.1 and afraid to update, as there seem to be less bugs than I had anticipated.
Copy link to clipboard
Copied
This code does not indicate it can write to the field and uses the zoom items from the menu that tend to add too much of a border... Gonna have a look at Stephen's code.
Copy link to clipboard
Copied
Try this mashup. You may only need line 2?
Change the - 2 for + 2 to enlarge 2% or whatever the desired value is:
// Fit on screen
app.runMenuItem(stringIDToTypeID('fitOnScreen'));
// Round to integer
var roundedZoom = parseInt(getActiveDocumentZoom());
// Reduce magnification -2%
setZoom(roundedZoom - 2);
// From mike hale
function getActiveDocumentZoom(){
var ref;
ref = new ActionReference();
ref.putProperty( charIDToTypeID( "Prpr" ),charIDToTypeID('Zm '));
ref.putEnumerated(charIDToTypeID('Dcmn'), charIDToTypeID( "Ordn" ), charIDToTypeID( "Trgt" ) );
return (executeActionGet(ref).getUnitDoubleValue (charIDToTypeID('Zm ')))*100;
};
// From xbytor
function setZoom(zoom) {
cTID = function (s) {
return app.charIDToTypeID(s);
};
var docRes = activeDocument.resolution;
activeDocument.resizeImage(undefined, undefined, 72 / (zoom / 100), ResampleMethod.NONE);
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putEnumerated(cTID("Mn "), cTID("MnIt"), cTID('PrnS'));
desc.putReference(cTID("null"), ref);
executeAction(cTID("slct"), desc, DialogModes.NO);
activeDocument.resizeImage(undefined, undefined, docRes, ResampleMethod.NONE);
}
P.S. You can also insert the menu item command for Fit On Screen into an action.
Copy link to clipboard
Copied
Just tested it and it seems to work perfectly. Thanks a bunch, Stephen! 🙂
Now I just have to relearn not using Ctrl+0 and lose another function key to this...
Copy link to clipboard
Copied
You're welcome. Standing on the shoulders of giants again...
You can remap CMD/CTRL 0 to the installed script (not browsed) via Edit > Keyboard Shortcuts: Application Menus, File > Scripts.
Copy link to clipboard
Copied
Forgot about that. Awesome! I'm often wishing we could attach an action or script every time we push the key for a certain tool, and I've been underestimating the possibilities already there, I guess. Thanks for the reminder! 🙂