Page 1 of 2


Posted: Sat Jul 03, 2010 12:47 am
by Mike Hale
Here is a CS4/CS5 script that will let you add a border(expand canvas) to an image. It can create even or uneven borders and allows you to choose the border color. Let me know if there are any errors I missed.


Posted: Sat Jul 03, 2010 2:49 am
by Mike Hale
In CS5 the 'dot' key has the same name for both the one on the main keyboard and the one in the number pad. In CS4 they have different names. Here is a fix so you can use either in both versions.

Code: Select allreturn  ((( event.keyName >= '0' ) && ( event.keyName <= '9' )) || event.keyName == 'Decimal' || event.keyName == 'Period') && ! KeyHasModifier ( event );


Posted: Sat Jul 03, 2010 7:11 am
by Gewuerz
Thanks Mike for the script.
I'm happy.
I have tested the script with the fix. The script works fine in CS4 and CS5.

Could one also take negative values, for inner borders? Is this still insertable?
This would be perfect.

Would be also nice if the script is also applicable for batch works.

Big thanks for the work, can I donate for your work?

Thanks Wolfgang


Posted: Sat Jul 03, 2010 9:21 am
by pierrelabbe
I try it with CS5 and CS4, it work fine.
I increased the size of some button for CS4.
The script dont apply the color if the doc is not flattened.
I translate the script in French.
Can I distribute it?


Posted: Sat Jul 03, 2010 3:17 pm
by Mike Hale
pierrelabbe wrote:Can I distribute it?

You can but I prefer that you wait until I have made the suggested changes. I know the dialog needs work. Even just on Windows the CS4 version does not look as good as the CS5 version and I have not check it on Mac.

! want to add a non-uniform trim and inner border feature. And make it action recordable so it can be used in an action that can be batched.

For the border color, it works with layers as long as the document has a background. I do not think I would want it to add the color if there is no background. Maybe I can set up the dialog so if there is no background layer the color is disabled like it is in the GUI Canvas Size.

It is a holiday weekend here in the USA so it may be the first of next week before I can post an update.

Thanks for the feedback and let me know about any other bugs/features.


Posted: Sat Jul 03, 2010 7:44 pm
by Mike Hale
Here is a new version. The changes are...

Will now accept negative values. This allows for non-uniform trimming of a document and inner borders.
Added option for inner border. If a negative value for a side is used and the inner border checkbox is checked it will create an inner border.
I have added localized ZString for as many of the strings as I could find. Please let me know if I made a poor choice and the string is out of context.

The dialog still needs attention. And I have not made it action recordable yet. I'm not sure what settings to use in the playbackParameters. Although the user can enter any unitType the script requires pixels.


Posted: Mon Jul 05, 2010 6:57 am
by pierrelabbe
Hi Mike,
It seems that this version does not work. It nothing happens (no window).
I delete the part "ZSTRING" (ligne 6 to 25) and there it works.


Posted: Mon Jul 05, 2010 2:06 pm
by Mike Hale
It does not run in Photoshop or just not in ESTK? With the <javascriptresource> section it will not run in ESTK. But it works for me in both Photoshop CS4 and CS5.

It is ok that you removed the <javascriptresource> section in this version as it is not finished and is not working. But in the next version that section will be needed to allow the script to be action recordable.


Posted: Mon Jul 05, 2010 4:29 pm
by pierrelabbe
You're right, it works in PS.
with "Inner border" check box, I have an error 21 :
Ligne: 213
-> colorDesc.putDouble( charIDToTypeID( "Rd " ), )


Posted: Mon Jul 05, 2010 6:47 pm
by Mike Hale
The script may still have bugs. I have only tested it using a RGB doc. That line will throw an error if "Rd " does not have four chars. The document mode may also be the reason.

I just did a quick test and the script failed with a CMYK doc but it did not throw an error at that line so check to make sure "Rd " has four chars. And only use on RGB images until I can post a fix.

How are the localization strings working for you?