Automatic cropping to a given "border" distance

Dear all,
Given some hand drawings which are firmly black on white background (no greys of any kind), is it possible to somehow (in CS5 for Mac) to crop an image in such a fashion that a specified amount of whitespace is left around the drawings? I.e., determine a 'bounding box' for the drawing and then enlarge it by so much in either direction, then crop?
Thanks,
K

Karljürgen wrote:
1. Trim doesn't seem to work predictably, i.e. sometimes it trims, sometimes it doesn't (I've even had it cut into the drawing). I shouldn't be the fault of pixel colour, because the final images were constructed using a layer filled with white and a mask filled with black for the drawings. I can't imagine what the problem is.
Perhaps you do not understand how Trim works it may not be the tool you should be using.  I also do not understand your discription of your Photoshop document construction please give us more details. Perhaps a screen captire or an example PSD file.  The following in from Photoshop Help.
Crop an image using the Trim command
The Trim command crops an image by removing unwanted image data in different ways than the Crop command. You can crop an image by trimming surrounding transparent pixels, or background pixels of the color you specify.
Choose Image > Trim.
In the Trim dialog box, select an option:
Transparent Pixels to trim away transparency at the edges of the image, leaving the smallest image containing nontransparent pixels.
Top Left Pixel Color to remove an area the color of the upper-left pixel from the image.
Bottom Right Pixel Color to remove an area the color of the lower right pixel from the image.
Select one or more areas of the image to trim away: Top, Bottom, Left, or Right.
2. I have several hundred drawings, and they vary in size. Canvas size expects an absolute input, which I can't predict in advance, and having to compute it manually is tedious and error prone. What I need is to add a relative amount. Better yet, trim within x pixels (or whatever) of the drawing....
No Canvas size has options so added canvas can be relative to the curremt camvas size and the amount of canvas can be relative to it DPI resolution or in absolute pixel size. Where the canvas is added can also be controlled by moving the anchor point.  You wrote your document vary in size.  Even if you have a mixture of Web size images and Print size images you can create an action to add a border relative to an image's size.  Adding a little script would be helpful for dealing with size. I'll explain your images have some size you have no idea about size in an action however you can still deal with it.  An image size is determined by the number of pixels and its DPI resolution.  When it come to Web Images DPI resolution is not important Pixel size is For Displays only use their DPI and display pixels at their DPI resolition Web images are sized to fit within some  display size like 800x600 pixels.
The best way to deal with Image size in an action is to first save its current DPI resolution, then scale the image to a known width or height, make your changes based on the now known syze, then restore the image to its original DPI scale.   An Action can not save and restore and images DPI on its own it needs a little Photoshop scripting to do that.  I'll give you that.  So to add a border the will be approate for an image's size is easy
Setp 1 Script Save and Restore DPI Resolition
Step 2 Scale image to 8" wide.  Image Size Resample NOT check, Set width to 8" Click OK. All the does is change the DPI
Step 3 Add 1" border and all sides. Canvas size check Relative, set both width and height to 2", leave anchor point centered and click OK.  Add some number of pixels on all sides based on DPI.
Step 4 Script Save and Restore DPI Resolition. 
SaveAndRestoreResolution.jsx
/* ======================================================================================
// 2009  John J. McAssey (JJMack)  http://www.mouseprints.net/
// This script is supplied as is. It is provided as freeware.
// The author accepts no liability for any problems arising from its use.
// This script is designed to be used by a Photoshop Action twice
// A good pratice to use when creating an actions that use this scipt is for the action
// not to do a save or play some other action between its two useages of this Script.
// The first time this script is used by an action the documents current resolution
// and ruler units are saved into the document's meta-data Info Instructions field.
// The second time this script used by the action the script retreives what was
// saved in the meta-data during the first usage, resolution and ruler units.
// The document is resized to the saved resolution,
// Photoshop's ruler units are set to saved units
// and the saved data is removed from the document's meta-data Info Instructions field.
// ===================================================================================== */
<javascriptresource>
<about>$$$/JavaScripts/SaveAndRestoreResolution/About=JJMack's SaveAndRestoreResolution.^r^rCopyright 2009 Mouseprints.^r^rRun twice script utility for action.^rNOTE:Don't play other actions between runs!^r^rFirst Run records Photoshop's preferences Units and documents DPI resolution.^rSecond Run restores the recorded setting and removes the recording.</about>
<category>JJMack's Action Run Twice Utility</category>
</javascriptresource>
if (app.documents.length > 0) {
          if (app.activeDocument.info.instructions.indexOf("<Resolution>") == -1 ){ // no footprint fisrt useage
                    //alert("first");
                    // Retreive Document information for Foot Print
                var units = app.preferences.rulerUnits;
                    app.preferences.rulerUnits = Units.PIXELS;          // set ruler units to PIXELS
                var typeunits = app.preferences.typeUnits;
                    var res = app.activeDocument.resolution;
                    // put footprint in metadata info instructions
                    app.activeDocument.info.instructions = app.activeDocument.info.instructions + "<Units>" + units + "</Units>"  + "<Tunits>" + typeunits + "</Tunits>" + "<Resolution>" + res + "</Resolution>";
                    //alert( "Saved ="  + "<Units>" + units + "</Units>" + "<Tunits>" + typeunits + "</Tunits>" + "<Resolution>" + res + "</Resolution>" );
                    app.preferences.rulerUnits = units;                    // restore ruler units
          else {
                    //alert("second");
                    // Retreive saved information
                    unitsOffset = app.activeDocument.info.instructions.indexOf("<Units>") + "<Units>".length;
                    unitsLength = app.activeDocument.info.instructions.indexOf("</Units>") -unitsOffset;
                    savedUnits = app.activeDocument.info.instructions.substr(unitsOffset, unitsLength);
                    tunitsOffset = app.activeDocument.info.instructions.indexOf("<Tunits>") + "<Tunits>".length;
                    tunitsLength = app.activeDocument.info.instructions.indexOf("</Tunits>") -tunitsOffset;
                    savedTunits = app.activeDocument.info.instructions.substr(tunitsOffset, tunitsLength);
                    resOffset = app.activeDocument.info.instructions.indexOf("<Resolution>") + "<Resolution>".length;
                    resLength = app.activeDocument.info.instructions.indexOf("</Resolution>") + -resOffset;
                    savedResolution = app.activeDocument.info.instructions.substr(resOffset, resLength);
                    //alert("Resolution = " + savedResolution + " Units = " + savedUnits );
                    // Restore resolution
                    app.preferences.rulerUnits = Units.PIXELS;
                    activeDocument.resizeImage(null, null, savedResolution, ResampleMethod.NONE);
                    // Restore ruler units
                    // I get a message Enumerated value expected if I try to use var savedUnits app.preferences.rulerUnits = savedUnits;
                    // perhaps if I knew Javascript I would not need to use the following if else if .....
                    if ( savedUnits == "Units.INCHES" ){ app.preferences.rulerUnits = Units.INCHES;}
                    else if ( savedUnits == "Units.CM" ){ app.preferences.rulerUnits = Units.CM;}
                    else if ( savedUnits == "Units.PERCENT" ){ app.preferences.rulerUnits = Units.PERCENT;}
                    else if ( savedUnits == "Units.MM" ){ app.preferences.rulerUnits = Units.MM;}
                    else if ( savedUnits == "Units.PIXELS" ){ app.preferences.rulerUnits = Units.PIXELS;}
                    else if ( savedUnits == "Units.POINTS" ){ app.preferences.rulerUnits = Units.POINTS;}
                    else if ( savedUnits == "Units.PICAS" ){ app.preferences.rulerUnits = Units.PICAS;}
                    // Restore Type units
                    if ( savedTunits == "TypeUnits.PIXELS" ){ app.preferences.typeUnits = TypeUnits.PIXELS;}
                    else if ( savedTunits == "TypeUnits.POINTS" ){ app.preferences.typeUnits = TypeUnits.POINTS;}
                    else if ( savedTunits == "TypeUnits.MM" ){ app.preferences.typeUnits = TypeUnits.MM;}
                    // Remove footprint from metadata info instructions
                    before = app.activeDocument.info.instructions.substr(0,app.activeDocument.info.instructions.indexO f("<Units>"));
                    afterOffset = app.activeDocument.info.instructions.indexOf("</Resolution>") + "</Resolution>".length;
                    after = app.activeDocument.info.instructions.substr(afterOffset, app.activeDocument.info.instructions.length - afterOffset);
                    //alert ("before = " + before + " after = " + after);
                    app.activeDocument.info.instructions = before + after;
else { alert("You must have at least one open document to run this script!"); }

Similar Messages

  • Adobe Premiere Pro Automatically Crops Source Video Upon Import

    This is really confusing me and I've never had this kind of trouble before.  I have source videos that are 720x480, but as soon as I import them into Premiere, they are cropped to 540x480.  It's not a problem with sequence settings or anything, because the imported source file is cropped before it's even in a sequence.  I tried looking on-line for a solution, but couldn't find any.  Does anyone know how this can be fixed...maybe some import settings that I don't know about?
    Here are some screenshots to visually represent what I was saying:
    This is properties of the video
    This is what Premiere automatically does right after the video is imported as a source
    This is a screenshot when played with VLC:
    This is a screenshot when played from the source in Premiere:
    Any help with this would be greatly appreciated.  This video is due Saturday and all my footage is cropped, please help me.  Thank you!

    11.  Re: Adobe Premiere Pro AND Adobe Premiere Elements 13 Automatically Crops Source Video Upon Import
    My AP Elements (version 13) has exactly the same bug. I have a DVD where 25% of every VOB file's images' right border has been cut away during the inserting phase into Elements. No adjusting of frame and pixel aspect ratios, black borders narrow or wide, project settings automatic or manual do not help. Gone is gone. But the same VOB files play normally (100% image) in many other players/editors. I have experimented with VLC and Wondershare Video Converter. 
    On the other hand Elements is able to read correctly other DVD's VOB files. See discussion about this very same bug in Elements thread.

  • How can I prevent iPhoto from automatically cropping my shot for printing?

    I've got a shot that is about 6 inches wide and 3 inches tall.  I want to print it on 5x7 inch paper but iPhoto keeps cropping it automatically so that there is no white space on top or bottom and cutting off the ends of my picture.  Is there a way to make it print on 5x7 without automatically cropping it?
    Thank you.

    Select a Custom size in the print window, i.e. 6 x 3, and try with the 5 x 7 stock.  That should place the image on the stock .
    OT

  • Is there a way to set up a button/action so that when a PDF is sent to print, it automatically crops it?

    I'm on a Mac with Yosemite, and am running Acrobat 9 Pro.
    I have an oversize PDF document that includes navigation tabs across the top like a website. It is interactive so a user can click through the PDF.
    My page size is 8.5"x11.5" - slightly taller than standard letterhead. I have a button set up to print a "printer friendly" version. What I'd like to do is set up an action on the print button so that the pages automatically crop 1/2" off the top, essentially getting rid of the tabs prior to printing. Is this possible using an action and pre-setting the crop amount?
    ~ bexterinni

    There is nothing you can do with iMovie program itself.  Slow response in usually due to a shortage of system resources (CPU, RAM and disk space).
    How much free disk space do you have on your boot drive and what is the capacity of the drive?
    You can check memory utilization while running iMovie using Activity Monitor (in Applications/Utilities).  What does the Memory tab show for Swap used?
    Are you running many other processor-intensive applications a the same time?
    If you have a lot of events and projects, it will help a bit to hide the ones you are not using by moving them from your iMovie Projects and iMovie Events folders into an enclosing folder so iMovie doesn't load them.
    Geoff.

  • Automatic crop ?

    Hi,
    I have a weird behavior of Lightroom today on one particular image.
    I don't understand what's happening and I don't know what I'm missing...
    I have this image of a train (portait) that I want to crop to landscape so I press R, do my crop, validate with Enter.
    I continue to the next image.
    When I come back to my train image, Lightroom automatically crop it in portait without asking me !
    Any idea ?

    Thanks for your fast answer.
    Can you developp the part "where the crop overlay doesn't touch the edges".
    If a corner of the crop overlay touch the right or left edge of the original photo, it should be ok ?
    In my case it is not...

  • Printing without automatic cropping

    Hello, When I print my photos, they are automatically cropped, and most of the time I lose important part of the photos. Please advise how I can print all of the original photo. 

    Please read this post then provide some details. What printer model? What operating system? What program are you using to print?  What size are your photo's (in pixels)?  What size are you trying to print?  Are you printing borderless?
    There are a few likely issues:  first, the image size of typical camera photo's have a different aspect ratio than typical 4x6, 5x7 or 8x10 photos.  Secondly, if you do have images of the proper aspect ratio and are printing in borderless mode there will be some overspray and clipping of the image to ensure there are no white spaces around the edges.  Depending on your printer model, operating system and driver you may be able to control the amount of overspray in the "advanced" tab of the driver.  Moving the overspray control toward "least" will minimize the amount of clipping.
    Bob Headrick,  HP Expert
    I am not an employee of HP, I am a volunteer posting here on my own time.
    If your problem is solved please click the "Accept as Solution" button ------------V
    If my answer was helpful please click the "Thumbs Up" to say "Thank You"--V

  • Automatic Cropping

    Hi,
    I'm trying to print 4x6 photos (after using iPhoto's cropping tool, to size each picture to 4x6), but they are automatically cropped even further by the printer.
    Any ideas on what's going on?
    Thanks!

    This is NOT an online service problem. This is also happening to me. I tried printing on two different printers and get identical results: a perfect 4x6 photo gets a bit cropped or chopped off. I tried printing from Preview and from Photoshop with identical results (I first thougth it was a printer issue so I called Epson; my other printer is a Canon). This has got to be a OS issue! None has answered it yet. I am going to run another test, printing on a Mac with OS Tiger to see what happens. I am also on hold for Apple Support as I write this message. By the way, there is a similar posting here:
    http://discussions.apple.com/thread.jspa?messageID=9347182

  • FCP X 10.1.3 is automatically cropping stills, making them unusable. Any ideas?

    FCP X 10.1.3 is automatically cropping stills, making them unusable. It is also doing the same thing to photos in existing projects. Unfortunately, I was trying to complete a project this morning and now it is worthless. Have rebooted and trashed preferences. Any ideas? Thanks.

    These are pictures from our iPhone 5 (3264 x 2448, jpg). The first attachment is the largest size FCP allows to be inserted. The second attachment is the full picture. The screen captures come from FCP's media viewer. If you hover over a picture you get the cropping,
    Project settings follow:
    Changing Spatial Conform settings has no effect. Deleting pictures and re-importing does not work either. Don't hesitate to ask for more information. Appreciate the help.

  • Scanned bmp, cut off with Automate, Crop

    I open PS and place a platen-load of photos on the scanner.
    Using HP Scanjet 7650 and Omnipage Pro 12 I scan making one bmp.
    I close the scanner program and have my bmp opened in PS.
    A. File, Automate, Crop and straighten results in 4 psd files.
    BUT
    sometimes one or more of the 4 are miscut by PSCS. I then have to go into the original composite .bmp and recrop just the one that was miscut. How to avoid this or what am I doing wrong.
    B.Let's say you've got 10 individual .bmps.
    How to convert all at once to jpegs of a certain dimension?

    If the post "Copy changed photos to Folder" gets answered, then that will be good enough for me here for now. Saw it after I posted mine.

  • HP Deskjet F4185 the paper scanned automatically crop.

    i have a problem with my scanner. i'd like to scan A4 paper contained 2 pictures on it. it can be scan, but the scanned paper that came out automatically cropped and divided into 2 pictures. i really need both of that pictures on the same file. sometimes, if i scan A4 paper that have more than one picture, the result came out is only one and not in the same size as the original one. help please. thank you.

    Hi @delldeyla,
    Welcome to the HP Forums!
    I see that your HP Deskjet F4185 the paper scanned is automatically cropped. I am happy to look into this cropping issue!
    For further assistance, I will need to know: If you are using a Windows or Mac Operating System, and the version number. To find the exact version, visit this link. Whatsmyos.
    Please see this post, Want Good Answers? Ask Good Questions, by @Bob_Headrick, so you can get the most out of these forums.  
    Hope to hear from you soon!
    RnRMusicMan
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos Thumbs Up" to say “Thanks” for helping!

  • How can I automatically crop a photo based on its content (a black border)?

    I scanned hundred of negatives.
    The scanner produced .jpg files.  Most of the scanned images show the negatives holder to one side as a black border.  The black border is thicker or thinner depending on the photo.
    Please see pictures attached. 
    Is there a way to automate the detection of such a border and remove it by cropping the photo?  Ideally I would like the processing to only remove the thickness that is required to keep the photo unaltered as much as possible.
    I have Photoshop 12 and I know about Actions.  I just don't know how to tell the engine to only crop if it is required, and by how much.
    This could save me days of manual work.  Thankyou.
    Environment Information:
    ·  I am running Photoshop 12.1 *64 bit
    ·  Windows 7 Professional 64 bit
    ·  Amount of installed RAM: 6GB
    ·       Scanner:  Canon CanoScan 8800F
    ·  Amount of free disk space:
                C:\ - OS and Software disk - Total size:139GB showing 20GB free
                G:\ - Data disk - Total size:1.81 TB showing 437GB free
    ·  Make/Model of Video Card: NVIDIA GeForce 9600 GT

    Thank you miss marple for your Image>Canvas Size... suggestion.  I used it to implement a semi automated process.
    I programmed a couple of actions:
    - one to trim all sides by 7 pixels
    - one to trim the top side by 7 pixles
    Then I assigned a shortcut key to each action.
    Since I have to open each photo individually anyway to remove larger scratches (see my other post), it is easy to hit a couple of keyboard keys to trigger the relevant 'border removal' action.
    The main thing is that in 95% of cases I don't have to use the mouse to fix the borders, but I use keyboard keys only.  It is a real time saver.

  • How can I stop iMovie from automatically cropping and applying kens burns to my photos?

    When I import stills into iMovie, it automatically adds a kens burns effect to each photo, and crops them. If I want to get rid of these effects, I have to do it manually for each individual photo. This takes alot of time and is very tedious to do. Is there a way that I can stop iMovie from automatically adding these effects? Or maybe a way that I can undo these effects on all photos at the same time?

    in the iMovie Project settings/pref, you can switch-off the automatic applying of KB

  • How to automatically crop images in Image Capture for import into iPhoto?

    On my PowerBook G4 / Mac OS X 10.4.2, I'm using the Image Capture 3.0.3 application to capture images coming from scanning photographs with a CanoScan 8400F.
    Can I get the Image Capture application to automatically set the crop frame on the overview? Other applications do that, but with Image Capture it seems that after I do the Overview (preview), I have to manually set the crop frame by clicking and dragging, before I can click the Scan button to do the scan?
    P.S. It seems that iPhoto does not handle scanning, and you do have to use a different application to scan photos before importing them into iPhoto.
    PowerBook G4   Mac OS X (10.4.2)  

    If you hide the details pane Image Capture will scan immediately to a specified folder. Other way is to open printers and faxing from the system preferences , select the scanning tab of your printer and click Open scanner. It will start scanning immediately without opening Image Capture. To set other software as default you should open Image Capture, select your printer/scanner and click the scanner buttons. It will then let you chose which program should be launched when you scan a document.

  • Acrobat 7.0 - Automatically crop and center pages

    Hello,
    I'm sorry if I'm using the wrong terminology. We are using Acrobat 7.0 but I'm sure the features are the same with newer versions.
    As part of our subscription we get sent scanned documentation for our Library. It's common the even pages to have the content located to the right side of the PDF with dead black area to the lefft and to the bottom. The odd pages are the opposite with the content to the top left and dead black space located to the right and to the bottom. This can change slightly from page to page since the document was likley scanned from a book. There also usually a title page which is located in the center of the first page.
    Need: We need to crop out the dead space on all pages and center them.
    Question: Is there a way for Acroabat to determine automatically the content that is good and remove the rest?
    Cropping seems to be one specific measurement applied to a range of pages. Our pages are different.
    I would appreciate any help. I can expand more if need be,
    (I just saw the attachement feature so I attached a few pages)

    Acrobat does not go through images to evaluate the content. You are making a judgement call when you do it. With your file I was able to use the crop tool for 2-5. P. 6 showed up offset and had to be changed. P. 1 was centered and different from the rest. I would use the odd and even features and then simply go back through and look for the pages that need to be touched up. That should do the trick. Supposedly Reduce File size will make the crop complete, but I have never found that to work well - it may be worth a shot. Another option is to print to a new PDF to delete the cropping.

  • 4:3 footage being automatically cropped when played on 4:3 TV's.  Converting to 16:9 no help either.

    Hi! I recorded some footage on my DV Camera in 4.3 aspect ratio.  I uploaded into a Premiere Pro CS4 project set up for 4.3, not 16.9.  Everything that's in the frame on the camera's display is there on the screen in Premiere.  The problem arises when I come to encode.  In Export Settings, you can chose to crop the image to 4:3 or 16:9. Either doesn't include the whole picture.  If you choose to no cropping you can set the boundaries around the image yourself, cutting out surrounding black, so that just the image is framed. This is what I did.  You then chose to export either in 4:3 or 16:9.  Choosing 4:3 and encoding in Adobe Encoder, I then set up a project in Encore, to burn to DVD in 4:3.  Playing the DVD on a 16:9 TV or Computer gives you all the image, but playing on a 4:3 TV crops off the sides and tops.  This I could understand if I was trying to play a 16:9 image on a 4:3 screen, but not 4:3 on a 4:3 screen.
    Just for experimentation I went back, and pasted the 4:3 footage into a Premiere project set up as 16:9.  I then exported as 16:9, and burnt to DVD as 16:9.  Plays fine on a 16:9 screen.  But on a 4:3 screen, while the whole image is present with nothing cut off, it's streched, so my subject's head and body are the wrong proportions.                                                       The only way that works is to paste the footage into a 16:9 project and apply black borders in Export Settings.  This does at least present all the image in proportion on a 4:3 screen, but the problem is its plays as a small screen in the middle of the TV surrounded by loads of black border.     I've tried the DVD on a couple of 4:3 TV's and had the same effect on each.
    I'd be grateful if anyone knows what I can do to get all the image to play on a 4:3 screen, without it being streched, small, or cropped.
    Thanks!
    John
    N.B.  I tried using the 4:3 and 16:9 cropping templates in Export Settings and as I saw there, they cut off bits of the image.
    Just for completeness; thinking if it's my Matrox RT X2 interfering, I pasted the footage into a non-Matrox Premiere project and burnt in a non-Matrox Encore project. It made no difference.

    I agree with Harm on both points. You should turn off cropping completely if you're going from a DV source (which you are) to an MPEG-2 DVD output (which you are). Just click the Crop button "off" on the Source tab.
    If you're seeing weird distortions on some television/DVD players, you may have the aspect ratio settings set improperly in the DVD players themselves. Typically, these settings need to be changed when you're viewing anamorphic (16:9 widescreen) DVDs; you change the setting to match your display preference to your television. Sometimes, the settings are not correct, and will result in unwanted stretching. This isn't necessarily the problem you're up against, but it might be something to check if things don't look right. Other than that, everything looks more or less correct in the export settings.

Maybe you are looking for

  • Procurement type and procurement indicator

    hi all, There is a mismatch  occurred in procurement in PS. i have configured a procurement indicator in ps and in control data i have checked PReq Network. After that When i assigned a material to the activity . In material details under purchase da

  • Is Robohelp 5x compatable with Windows 7

    Is Robohelp 5x compatable with Windows 7 - what will happen if I upgrade to Windows 7

  • Firefox desktop and start menu shortcuts were hidden after install - why?

    Hi I just installed Firfox 5 and after installing both the desktop shortcut and the start menu shortcut were marked as hidden in windows. Anyone else experienced this and have any ideas what could have caused this. It was rather confusing. I'm runnin

  • 11.1.1.3 Workspace report prompt delay

    Running v11.1.1.3 on Linux RAC with Weblogic. Encountering slow performance when accessing a report with prompts via the workspace. When a report is selected using prompts for the 1st time in a new workspace session, we are experienceing extremely sl

  • Flash Buttons and a nested movie clip

    I have made my movie clip and now I want to nest it into a button. I am not sure what code I need to use for this and how to nest it. I want, when a person rolls over the button for the movie clip to run. When they roll off of the button the movie cl