Cropping a black area?

I´ve seen there are some scripts here for Cropping and straighten photos from a scanner. But i have a particular problem where i need to remove the black border and leave the black area as transparency for a large number of photos, but leaving the photos unstraightened. I wonder if anyone can give me an idea on how to do this. For reference i post the script i found before for Straightening and cropping.
#target Photoshop
app.bringToFront;
var inFolder = Folder.selectDialog("Please select folder to process");
if(inFolder != null){
var fileList = inFolder.getFiles(/\.(jpg|tif||psd|)$/i);
var outfolder = new Folder(decodeURI(inFolder) + "/Edited");
if (outfolder.exists == false) outfolder.create();
for(var a = 0 ;a < fileList.length; a++){
if(fileList[a] instanceof File){
var doc= open(fileList[a]);
doc.flatten();
var docname = fileList[a].name.slice(0,-4);
CropStraighten();
doc.close(SaveOptions.DONOTSAVECHANGES);
var count = 1;
while(app.documents.length){
var saveFile = new File(decodeURI(outfolder) + "/" + docname +"#"+ zeroPad(count,3) + ".tif");
SaveTIFF(saveFile);
activeDocument.close(SaveOptions.DONOTSAVECHANGES) ;
count++;
function CropStraighten() {
function cTID(s) { return app.charIDToTypeID(s); };
function sTID(s) { return app.stringIDToTypeID(s); };
executeAction( sTID('CropPhotosAuto0001'), undefined, DialogModes.NO );
function SaveTIFF(saveFile){
tiffSaveOptions = new TiffSaveOptions();
tiffSaveOptions.embedColorProfile = true;
tiffSaveOptions.alphaChannels = true;
tiffSaveOptions.imageCompression = TIFFEncoding.TIFFLZW;
activeDocument.saveAs(saveFile, tiffSaveOptions, false, Extension.LOWERCASE);
function zeroPad(n, s) {
n = n.toString();
while (n.length < s) n = '0' + n;
return n;

I have similar data, but a different scripting/action need. I need to label each scanned image with it's filename and place it on the photo, within the photo frame (in some cases, old aerial photos that have been scanned) or within the bounds on new digital photography. Basically, the script I have now is putting it in the black area either completely or partially depending on how much the image is rotated. It's the simple AddFileName.jsx and places the text based off the percent from the left and top values that I put in. The problem I'm running into is that the rotation of the photos changes with each one due to the flight path of the aircraft that took the photos and I'd like a script or an action set that I can use to get PS to detect the pixels immediately within the black area (i.e. on the actual image) and then place the text layer based off that "edge" and the parameters (size, color, etc.) I've set. If there is a way to get the script to determine the first "non-black" pixel and base the placement of the text off of that, then that would probably work. I'm not as concerned with the angle of the text, although it would be great if I could get it to align with the edge of the actual photo and not the bounding box.
My scripting skills are novice at best. I'm comfortable with recording actions and wouldn't mind a combo of the two automation capabilities. For image examples, you can use the ones already provided in this post. We're dealing with similar imagery.
Any assistance you can provide would be greatly appreciated!

Similar Messages

  • HP Color Laserjet 2840 prints patchy areas instead of solid black areas

    I have a printer that's about 4-5 years old and LOVE it. However, recently it stopped printing solid black areas when I print artwork. When I print text only, there are no problems--only when I print artwork. It's got a new imaging drum and plenty of black ink. I don't have much money and can't afford a new one, so I'm wondering if anyone has any ideas what needs to be fixed. Thank you in advance!

    Hi @kenlock153,
    Welcome to the HP Forums!
    To get your issue more exposure I would suggest posting it in the commercial forums since the HP Color LaserJet 2840 is a commercial product. You can do this at HP Enterprise Business Community.
    The support page for your product may be helpful in the meantime:
    HP Support Center.
    I hope this helps! 
    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!

  • Blue lines in black areas using external monitor

    I am running my 13" MB Pro hooked up to a ViewSonic LED LCD Monitor (VX2250) (DVI link using generic knock off mini-display to DVI adapter).
    The problem I'm having is that black areas on the monitor will have fuzzy horizontal blue lines running through them. So if I'm doing graphic design stuff that has black areas, these fuzzy lines will show up. Sometimes they are thin, sometimes they are thick.
    If I move the black area around, the lines stay in the same place relative to the black area. They don't stay put relative to the screen (if that makes sense). So I'm fairly sure its not the monitor, as I would imagine they would stay in place within the monitor if the monitor had issues.
    Any suggestions? Could the knock-off DVI adapter be the culprit (never had this problem on an older non-LED LCD display using same adapter). Thanks for any suggestions.

    Anyone?

  • Acrobat 9 Pro has started showing incorrect black areas

    My Acrobat 9 Pro (Win 7) has started displaying black areas where normal content should be, The same PDF files display correctly with Adobe Reader. This same
    Acrobat worked fine for a long time, but a few months ago began displaying black instead of some content.
    Sorry, but I couldn't find a "community" that fit this issue so I put it under Installatiohn & Update. Feel free to change the secton.

    Hey,
    With the end of support for Acrobat 9, it might not be possible to find updates there.
    You can access Acrobat 9 updates for the version 9.5.5. via the following link:
    For Windows: "ftp://ftp.adobe.com/pub/adobe/acrobat/win"
    Hope this helps.
    Regards,
    Anubha

  • How do you make the black area in an FLV playback white or transparent

    Trying to make the FLV playback black area white or
    transparent, because there is a black flash that shows up when play
    the movie. I am trying to alleviate this by changing the black area
    to another color or alpha.

    In your publish settings, click on the HTML tab and look for
    a field entitled 'Window Mode'. One of the choices is 'Transparent
    Windowless'. This should work if you have objects that don't have
    backgrounds. If you are looking to make video transparent, so far
    in my experience, the only video I have been able to make this work
    with is a Quicktime Animation with the RGB + Alpha. Also, when you
    import your video to the stage, make sure to click on the 'Encode
    Alpha Channel' box. That will give you the transparency you're
    looking for.

  • Reader XI: after opening a pdf I get black areas in the doc when scrolling down

    Hello,
    I have a problem with acrobat reader XI after a new installation of my hdd.
    After opening a pdf, I get black areas in the pdf when I scroll down. The black area disspear when scrolling up. What can I do? Win7 Prof 64bit
    Many thanks in advance
    Michael

    Hello Michael,
    Please make sure that you are using latest version of Reader XI.
    Please Go to Help-> Check for Updates...
    Regards,
    Anoop

  • Flickering green in black areas of screen

    I have a flickering green in the black areas of my monitor.  As if the Enhance contrast is set above Normal in Applications System Preferences Universal Access.  Though the slider is still set down at Normal.

    It does sound like the XT1900 is to blame. What you see is DVI noise. If you search this forum, you will see that it has been a common problem. If the MacPro is under warranty, then I would ask Apple for a replacement.

  • Camera Raw 8 the same cropping choices as are in Lightroom and Photoshop?

    Seriously, how hard would it be to give Camera Raw 8 the same cropping choices as are in Lightroom and Photoshop (i.e., Fibonacci, Triangle, Diagonal, etc.)? This disparity in features is inexcusable and embarrassing. Surely the teams communicate?

    I don't have CC nor LR.  Just be sure you are comparing apples to apples
    That is a nice statement for a Windows guy…
    I never use crop in ACR because I like this feature more in PS itself. Also the inability to save crop presets in ACR makes it very limited. The ACR engine for PS and LR are the same, the body differs.
    Thanks to hard yelling people we now have about the same crop tool in PS as in LR. Although I still don't like it in PS, after having used it years and years I now have to move the image instead of the crop.
    Sadly the ability to rotate crop and having adjust it automatically to the borders is a very nice option. If it wasn't for this I would stay with the old classic mode.
    But the OP is right, many features in different Adobe Products have somewhat the same result but sometimes very different approaches, options and tools.
    Until the Adobe HQ is going to settle in Utopia we might be better off trying to learn living with it

  • Today morning i turned my macbook on and i saw all the black area of screen has green lines and dots all over , can anybody tell me what causes it , and how to fix it, please anyone can help

    plz help with my graphic problem as i noticed tthis morning all the black area of the screen turned into green, anyone help me? will be apriciated,
    thanks in advance

    clintonfrombirmingham wrote:
    Which model do you have? If a mid-2010 15", there are known problems with the GPU and the logic board will be replaced free.
    Clinton
    The Mid 2010 15-inch MacBook Pro problems are related to kernel panics, so the GPU is still working. In the case of the OP, the GPU has stopped working completely, so his/her problem doesn't belong to the kernel panic problem, so the OP may have to pay. I may be wrong.
    Also, the 10.8.4 update won't help as this is a hardware problem, but it's always good to keep OS X updated

  • Dancing pixels in large black areas of my new 30 inch ACD

    I posted this on a thread in the 2004 forum, and then thought to post it here since I just bought my 30 inch LCD new from the Apple Store yesterday.
    I have a dancing pixel / pixel static problem, which happens whenever there are large black spaces on the screen, such as the black computer name screen saver, or the black screen where you enter your password to get back into your account from secure sleep. The dancing pixel static also appears in Terminal windows that are set to have a solid black blackground.
    To deal with this problem, I just decided to set my Terminal and gvim backgrounds to dark grey. This seems to be a tolerable solution. I also took all the firewire and USB cables out from the back of the display, which was proposed by Apple support as a fix to this sort problem last year, as someone reported in the forum.
    I still have to deal with the dancing pixel static in the short interval between the time I activate any screensaver with a hot corner, and the appearance of the same. And the static is all over the place when I try to get out of the screen saver and have to give me password.
    I think I can live with that as long as the problem doesn't get worse... Anyone have a similar experience?
    Macbook Pro   Mac OS X (10.4.6)  

    OK I went to the Apple Store today and they let me trade it in for a new 30 inch LCD. This one is definitely better. There is some pixel static still in large black areas. But much, much less. I hardly notice it, though I can if I look for it. But overall I'm very happy with it now. I love the screen. 30 inches really makes a huge difference.
    I wonder though what's the deal with large black areas that causes this to happen on the LCDs.

  • Black areas are showing up as green

    Since I upgraded to Firefox V:8 some of the images show the black areas (background, shadows, and the like) as a bright green. If I change to the IE engine, the problem goes away. I've messed with disabling the add-ons, without any repeatable fix. Sometimes, disabling one of them will fix the problem, until the next day, when things are messed again(?).
    The problem seems to link to JPEG images, but I am not going to guarantee that just yet.
    http://ashleymichelew.blogspot.com/ is one place I've seen the problem.

    That can be caused by a problem with the color profile for your display monitor or color profiles embedded in images.<br />
    You can disable color management to test that.<br />
    You can set the pref gfx.color_management.mode to 0 on the about:config page to disable Color Management.<br />
    You need to close and restart Firefox to make the change effective.
    See:
    * http://kb.mozillazine.org/gfx.color_management.mode

  • Replacement screen shows all Blacks are instead, Super-Blue's!

    My original Dv7-3065dx screen went blank with the back-light still going. Every so often, it would work for a second, then go blank again. so i changed the cable and screen. The new screen worked, except now all the blacks, are super blue! So, of course i thought i got a bad screen, so got another one, but this time it seemed even worse! Upon turning it on, the windows symbol, even steaked blue across the screen, then same thing, all blacks, super blue! 
    I do want to mention, just in case, the fact that i purchased after market screen, from Amazon, for like $85, that had a converter cable on the back running from the left side connect to the right side connect, so i could connect on the right side. 
    Could these cables on the back of the aftermarket screens be causing this super blue problem? 
    I have check connections, to make sure it is pluged in like it should be.
    External monitor works fine. 
    Also, i have already dissassembled the entire laptop, and cleaned the fan and re-thermo'ed the cpu! Runs alot cooler, screen works, but all the blacks, are still super blue, with occasional blank screen period.
    What's next?
    Anyone?

    OK!!!!!!!!!!!!      I got my 3rd screen in today, from the site you told me about. I got the one w/o the converter cable on the back of it. AND GUESS WHAT?????????????? IT FRICKIN WORKS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    AMAZON SELLS CRAP FOR SCREENS!!!!!!!!!!!!!!!!
    I almost kept the 2nd screen, because i thought there was no way it could be both screens, BUT IT FRICKIN WAS!
    Sorry for all the caps and !!!!!!!!!!!!, but i am happy and pissed at the same time, because of the headache AMAZON caused me!
    Anyway, i am hoping you also tried the one with the cable on the back, so if you did, your problem should be fixed with this also!
    Let me know. 

  • Render is Flat Blacks are grays

    I have just switching from FCP to Premiere Pro everything run smoothly exept for my export.
    it look verry flat and the black are not black. I have try the Match sequence and an h264 both the exact same thing
    I have also try different player
    here is a screen shot with vlc and PP on the back with my title plate
    Thanks for helping

    I find it if it can help others it's the Nvidia setting
    You have to set full (0-255) for the dynamic range

  • Black area showing in Maps

    I'm getting a big squared black area near to where I live, so if I try to make a route that goes through that black area it just won't create it.
    That black area dissapears when I zoom out a lot (almost showing the entire country) but it persists when I zoom in. I have also discovered that it shows in Hybrid and Satellite, but it doesn't show in Standard.
    I've tried restarting the app, restarting iPad... and the problem is still there. This is happening since 1-2 months. I also have looked for info on the internet and found nothing similar to this, anyone knows what could it be or some solution? this is really frustrating
    I uploaded a couple of screenshots so you can watch it, is the same area with different levels of zoom:

    i think what you have found is a missing map in the system.  Out of curiosity i  is this Spain?
    In any event, under the curled up tab in the bottom right should be a link to report this problem directly to apple maps.  They don't know unless somebody tells them.  I also note you are running 6.1 - the screen look somewhat different in 7.1.1 - but the maps are likely the same.
    kinda makes you feel funny when where you live does not show up...

  • Red Pixels in Black Areas

    I just purchased my MBP last week, and so far things have been pretty good. Just one minor issue that I can't seem to figure out; at times when I am viewing black areas, they have a bunch of little red pixels inside them. It's not that the pixels get stuck, I can scroll the images and the red pixels stay in the same area of the picture.
    Has anyone else had a similar situation or a solution?
    http://h.imagehost.org/0620/Screenshot_2010-08-04_at_12_10_52AM.png

    When I look at it, there are little red pixels all over cat's paw. I will have to actually take a picture of my screen with a camera. The red areas sometimes flicker, but it's never a big botch of red, just a lot of nearby pixels. It is not the image, I can see the image clearly on my PC, on here there are red pixels on it.
    I will take a photo and post it ASAP.
    Message was edited by: kk2438

Maybe you are looking for