Hi Denis,
I’ve managed to get the script to work at last.
I’ve added in a few lines of code from another script that sets the ruler units to pixels and then restores the ruler units to their original setting after the script runs.
The following block of code is at the end of the script. I’ve added the lines needed to make the script work Anyone who’s interested can either add in the lines manually, or just copy the whole block into the script and replace the original block.
I’m not a scripting expert, so what I suggest may not be the most elegant solution, but it does work.
//
———————————————————— ———————————— // Start of main() processing
—Start of main() processing—
//
———————————————————— ————————————
if ( documents.length <= 0 ) {
alert(ui_NoOpenDocument); // so we crash out
return;
}
// add the next 2 lines to the AutocropV2 script
var originalRulerUnits = preferences.rulerUnits;
preferences.rulerUnits = Units.PIXELS;
//
try {
var docRef = activeDocument;
var settings = settingDialog(chosenMethod);
settings.show();
switch(chosenMethod) {
case 1:
doCropBinChop();
break;
case 2:
doCropSlice();
break;
case 3:
doCropUniPixel();
break;
} // End switch
} catch (e) {
alert("Something’s bollixed. Error name: " + e.name + ". Error message: " + e.message);
throw e;
} // end try
//Add the following line to the AutocropV2 Script
preferences.rulerUnits = originalRulerUnits;
//
} // end function main
//
============================================================ ==================================== // Dispatch
//
============================================================ ====================================
main();
On Wed, 13 Jul 2005 11:21:24 -0700, Denis Perelyubskiy
wrote:
Hello,
If you get it to work on CS2, I’d love to have a copy.
I almost did 🙂 I tried the binary method, and it actually cropped something for me, but not until I made a rather small change. Then I got stuck, thinking that I came up with a better way to figure out corner locations (tried computing them based on bounds of selections, since you can grow a selection of background color).
In the meantime, one problem I immediately noticed (and the one that stopped the script from executing for me) was that the script would only work if your ruler is set to PIXEL units. If the script does not work for you, try changing ruler units to pixels.
If this takes care of the problem, I can tell you how to modify the script (or will just post an updated script somewhere. It takes all of 4 lines of code) to not have to change units manually while I figure out if I can change the algorithm.
denis
George Dingwall wrote:
Hi Denis,
If you get it to work on CS2, I’d love to have a copy.
Good luck.
On Tue, 12 Jul 2005 12:21:00 -0700, Denis Perelyubskiy
wrote:
Hello. Got it. THANKS!
There is a javascript source, so while I use CS2, I think this will be a great starting point. I could probably take it from here (or maybe it will just work… cause things always do, right? 😉 ).
This has been a MAJOR annoyance of mine ever since I started using Photoshop 🙂 thanks again!
denis
George Dingwall wrote:
Hi Denis,
If your using Photoshop CS ( not CS2) , you can get a script from Adobe Share Studio which will do what you want to do. It might also work with version 7 with the scripting plugin, but I’ve never used it with that version.
Go to this link and then select Photoshop/Scripts. In the scripts section look for a script named Autocrop.
Hope this helps.
On Mon, 11 Jul 2005 21:17:14 -0700, Denis Perelyubskiy
wrote:
Hello,
I searched, but did not find the answer, so forgive me if this has been asked.
After I rotate canvas, I want to automagically crop. Let’s say I rotated clockwise. I would like to crop with left border through upper-left, right border through lower-right, upper horizontal border through upper-right, and lower horizontal through lower left corners.
I don’t mind setting background color to something that is guaranteed to stand out from the picture, if photoshop could use this information to determine where picture ends and background begins.
I know one can rotate a crop selection, and this will auto crop and rotate, but I can’t get used to this method.
Is there a plugin, action, etc that would allow me to accomplish this auto-crop task?
thanks!
denis
Bye for now,
George Dingwall
Invergordon, Scotland
www.georgedingwall.freeuk.com
Bye for now,
George Dingwall
Invergordon, Scotland
www.georgedingwall.freeuk.com
Bye for now,
George Dingwall
Invergordon, Scotland
www.georgedingwall.freeuk.com