Skip navigation
Currently Being Moderated

Script:  Trim the canvas to remove unused areas from the sides

Apr 25, 2012 2:36 PM

If you're working on an image and wind up with a canvas that's larger than the image pixels, here's a simple little script that will trim away the unused areas.  It'll reduce the canvas to the smallest size that contains all the pixels of the actual images.  In other words, it takes the value of the top left pixel of the canvas and uses that info to trim away pixels, so this script will work on a canvas having transparent pixels as well as coloured pixels.

 

Here are the steps to install the script:

 

  1. Open Notepad. 
  2. Copy this text and paste it into Notepad:


/*

<javascriptresource>
<name>Trim</name>
<menu>automate</menu>
<about>Trim the canvas.</about>
<category>Image</category>
</javascriptresource>
*/

app.activeDocument.trim()

 

 

  1. Use "Save As" with the File Type of "All Files" to save it as
    Trim.jsx
    in the
    C:\Program Files (x86)\Adobe\Photoshop Elements 10\Presets\Scripts
    directory.
  2. Start PSE.  You'll have a new menu item:  File...Automation Tools...Trim.

 

Enjoy!

 

Ken

 

Message was edited by: photodrawken to correct explanation.

 
Replies
  • Currently Being Moderated
    Apr 25, 2012 7:29 PM   in reply to photodrawken

    Thanks for posting the script and i'm sure many people will be grateful, since elements doesn't have trim command like photoshop.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 29, 2012 3:39 PM   in reply to photodrawken

    Thank you, thank you, thank you! As a former PhotoShop user who's downsized to PSE, it was driving me crazy!

     

    I'm able to figure out most things, but I could't figure out where they hid the "trim" command.

     

    PS: I'll have to check out Elements+

     

    JoAnn

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 30, 2012 6:55 AM   in reply to photodrawken

    Does this not duplicate the functionality of the recompose tool?

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 30, 2012 8:23 AM   in reply to photodrawken

    Another workaround, in that situation where the subject is surrounded by a transparent background:

    - Select the transparent outer background with the magic wand.

    - Inverse selection (shift ctrl I)

    - menu image/crop

     

     

    PS: another vote for Elements+

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 30, 2012 9:17 AM   in reply to photodrawken

    photodrawken wrote:

     

    Michel,

     

    Yes, that also seems to work when backgrounds are filled with colour.

     

    Ken

    To be precise :

    There might be a selection problem if part of the useful selection is the same color as the background (white part on white background for instance), but in most cases that will not change the trimming.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)