Batch Crop & Straighten Photos...? Please, Help.

I have several hundred photos that have been scanned and they all need to be cropped and straightened. I have been unsuccessful in my attempts at being able to create and run a action or script to batch this automated feature in Photoshop CS4. Does anyone know how to accomplish this? Thanks.

Here is a web site that looks like it will show you how to do it.  If not look at similar sites.
http://www.webdesign.org/web/photoshop/tutorials/automate-crop-straighten-from-scans.3715. html

Similar Messages

  • Crop & Straighten photos problems

    Not sure if this can help anyone having problems using "Crop & Straighten photos"!
    I'm using CS3 (but I'm guessing the problem may exist in other versions) to try and subdivide a huge pile of old scanned prints. To make the job easier, I scanned with only 2 images on the platen so that there is plenty of white space around each image.
    When I try and apply the "Crop & Straighten photos" command, in almost every case it fails, only creating a duplicate image which looks ALMOST identical to the original. However if I then apply "Crop & Straighten photos" to that copy, it works perfectly.
    What I discovered is that my scanners (both HP models, a flat bed and an all-in-one) both create a scan with a fairly thick black edge on two sides of the image.
    So when I apply "Crop & Straighten photos", Photoshop thinks (quite correctly) that the image actually extends to the edge of the original scan, and there is therefore nothing to divide.
    The solution is to re-size the original image to 99%., and then apply "Crop & Straighten photos" and it works perfectly. So far 99% has worked on all the images I've tried, but it may need to be changed to 98 or lower in exceptional circumstances. Since the scanned photos are well away from the edges, there is no danger of cropping any of the originals scans, but be on the lookout just in case.
    Finally, I created an action to crop to 99% and save all the images (to a new directory), meaning I could automate that step, and then I used the script provided elsewhere in this forum to automate the "Crop & Straighten photos".
    Works a treat, and saves loads of time
    Colin

    Here is a web site that looks like it will show you how to do it.  If not look at similar sites.
    http://www.webdesign.org/web/photoshop/tutorials/automate-crop-straighten-from-scans.3715. html

  • How do I remove an email account from iPhoto on an iMac? I set it up with the incorrect password and can no longer send photos, please help!

    "Removing email account from iPhoto"
    How do I remove an email account from iPhoto on an iMac? I set it up with the incorrect password and can no longer send photos, please help!

    To follow Larry's advice, select your email account in the list of accounts and click the "-" button to remove the account:

  • TS2755 the pic butten on messages is not working. can not send or recieve photos. please help.

    the pic butten on messages is not working. can not send or recieve photos. please help.

    Hi Beharley,
    try resetting your network settings: Settings - General - Reset - Reset Network Settings. This works fine if something is messed up with your carrier bundle.
    Regards, Peter

  • During restore of my backup on iphone 5s i saw my photos and videos get doubled on ios 8.0 and moreover if i use to go at my computer and then open my iphone and in folder i see some files name local disk and my photos please help my memory doubles.

    during restore of my backup on iphone 5s i saw my photos and videos get doubled on ios 8.0 and moreover
    if i use to go at my computer and then open my iphone and in folder i see some files name local disk and my photos
    please help my memory doubles.

    I'm not sure, but I know it's not recommended to upgrade to iOS 8 on anything older than an iPhone 5. I only lost my music playlists and music that was on my phone, but that music is also on my iTunes, not the playlists though, and I don't want to go through ALL my iTunes library to fix it either... But it seems I don't have a choice right now.
    Whatever you do, do NOT upgrade to iCloud Drive, keep iCloud till OS X Yosemite comes out, if your computer is a Mac. I also just noticed that all my documents on my phone are gone from Pages, BUT if I go on the iCloud website they are still there. Hopefully it will all work itself out when I can update my macbook pro to OS X Yosemite.
    If you backed up your phone and all your purchases off your iPhone prior to trying to upgrade you should be fine... But I'm not even remotely sure.

  • My sis. tryed to break my pass and now it says to conect to itunes  but i captured so many photos from the last sync  how to sync without deleting this photos please help

    my sis. tryed to break my pass and now it says to conect to itunes  but i captured so many photos from the last sync  how to sync without deleting this photos please help

    egzoni 123 wrote:
    my sis. tryed to break my pass and now it says to conect to itunes  but i captured so many photos from the last sync  how to sync without deleting this photos please help
    If you Restore using last computer you synced to the password will be removed and you can restore the last backup on your computer, which includes your camera roll.
    If you enabled Photo Stream in iCloud your photos are in Photo Stream.
    If you had installed one of the many apps that can upload photos to a photo sharing site and had used it you will have your photos.
    If you have done none of these things you are out of luck. The phone comes with many tools to preserve content, but you have to use them.

  • My new iphone 5s is locked with 'Restore failed'. i have pressed the sleep button togther with the radial button the fron to restore but nothing happens except it clikc to take a photo. please help soooo fustrated?

    my new iphone 5s is locked with 'Restore failed'. i have pressed the sleep button togther with the radial button the fron to restore but nothing happens except it clikc to take a photo. please help soooo fustrated?

    What is the error number in the error message? To reset the phone you must press and HOLD both buttons for at least 10 seconds, and longer until an Apple logo appears.

  • Batch Crop & Straighten

    A while ago a good chap helped me out by creating a script that prompted the user for a folder, then ran the Crop and Straighten Photos command on all images contained in the folder and saved the newly created photos in a new folder.  The script is below.
    The script saves cropped photos as PNGs, I'd like to save them as JPEG.  Could someone help me out by tweaking the script to save as JPEG?  I'd like them saved with the highest quality option.
    #target Photoshop
    app.bringToFront;
    var inFolder = Folder.selectDialog("Please select folder to process");
    if(inFolder != null){
         var fileList = inFolder.getFiles(/\.(jpg|tif|png|)$/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) + ".png");
                        SavePNG(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 SavePNG(saveFile){
        pngSaveOptions = new PNGSaveOptions();
        pngSaveOptions.embedColorProfile = true;
        pngSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
        pngSaveOptions.matte = MatteType.NONE;
        pngSaveOptions.quality = 1;
         pngSaveOptions.PNG8 = false; //24 bit PNG
        pngSaveOptions.transparency = true;
         activeDocument.saveAs(saveFile, pngSaveOptions, true, Extension.LOWERCASE);
    function zeroPad(n, s) {
         n = n.toString();
         while (n.length < s) n = '0' + n;
         return n;

    What a great script. I extended it to recurse through subdirectories, and to filter out images that are too small to be reasonable crops. I hope this helps someone else as much as the original helped me.
    #target Photoshop
    // This script recurses through a directory structure and saves straightened/cropped images to// a "StraightenedAndCropped" subfolder.// The function that does this tends to produce a lot of junk, so // this script also filters out images that aren't large enough to// be likely candidates.
    // optional (for debugging)//$.level = 2//$.bp()
    app.bringToFront;// you can use a folder selection dialogvar inFolder = Folder.selectDialog("Please select top-level folder to process");// or you can hard-code the folder if you like (making sure to escape the path in Windows)//var inFolder = new Folder("C:\\some\\folder");if(inFolder != null){    ProcessFolder(inFolder);};
    function ProcessFolder(folder) {    // process any files here first    var fileList = folder.getFiles(/\.(jpg|tif|psd|)$/i);
        if (fileList.length > 0) {        // only create a subfolder etc. if we found anything        var outfolder = new Folder(decodeURI(folder) + "/StraightenedAndCropped");        // not sure whether the exists property refreshes on-demand so save an indicator of whether we created the folder        var created = false;        //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();                var originalWidth = doc.width;                var originalHeight = doc.height;                doc.close(SaveOptions.DONOTSAVECHANGES);                var count = 1;                while(app.documents.length){                    // if the width and  height of the derived image are not both at least 85% of both of the original dimensions,                    // do not save it at all                    if (activeDocument.width.value >= (originalWidth.value * .85)                    && activeDocument.height.value >= (originalHeight.value * .85)) {                        // create the output folder on demand                        if ((outfolder.exists == false) && !created) {                            outfolder.create();                            created = true;                        }                        var saveFile = new File(decodeURI(outfolder) + "/" + docname +"#"+ zeroPad(count,3) + ".jpg");                        SaveJPEG(saveFile, 12);                        count++;                    }                    activeDocument.close(SaveOptions.DONOTSAVECHANGES) ;                }            }        }    }
        // now go looking for new folders, and recurse into them (just don't recurse into our own folders)    var fileAndFolderList = folder.getFiles();    for (var i = 0; i < fileAndFolderList.length; i++){        if (fileAndFolderList[i] instanceof Folder && !endsWith(decodeURI(fileAndFolderList[i]), "StraightenedAndCropped")) {            ProcessFolder(fileAndFolderList[i]);        }    }};
    // borrowed from http://stackoverflow.com/questions/280634/endswith-in-javascriptfunction endsWith(str, suffix) {    return str.indexOf(suffix, str.length - suffix.length) !== -1;}
    function CropStraighten() {    executeAction( stringIDToTypeID('CropPhotosAuto0001'), undefined, DialogModes.NO );};
    function SaveJPEG(saveFile, jpegQuality){    jpgSaveOptions = new JPEGSaveOptions();    jpgSaveOptions.embedColorProfile = true;    jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;    jpgSaveOptions.matte = MatteType.NONE;    jpgSaveOptions.quality = jpegQuality;    activeDocument.saveAs(saveFile, jpgSaveOptions, true,Extension.LOWERCASE);}
    function zeroPad(n, s) {    n = n.toString();    while (n.length < s) n = '0' + n;    return n;};

  • I might have messed up my files and now have the big exclamation mark on a lot (but not all of my iphotos) My document folder was full of photos and I tried to organize it by putting it into a separate folder but now I can't see my photos :-( please help?

    Hi there, I have the same problem as I've read on some of the questions posted although the answers hasn't been much help to me with regards to the big exclamation mark on iphotos when I try to open my photos.  For some reason my photo files was stored in my document folder and you can imagine how that must have looked, very unorganized.  When I tried to move the photos from there to another file that is just for my photos.  Now I can't open them in iphotos and although I tried to undo my mistake it still doesn't want to work.. is there any way I can find all the images on my computer and fix my problem by storing them somewhere else without damaging the files?
    Please help me find all my photos as I would be shattered if I were to loose any...
    Thank you.

    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Rebuild iPhoto Library Database from automatic backup.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. .
    Regards
    TD

  • My friend wanted to get some of the music off my itunes. when syncing it needed to udate her phone which it did - now all her photos are gone. and the last back up was from when she used my itunes 6  ago. How can we get back her photos :(Please help

    My friend wanted to get some music off my itunes - when syncing it it said she had to update her phone software first - which it did. Now all her photos are gone. When we tried to restore the last back up - the only one was from when she used my itunes 6 months ago which was from her old iphone. So now it has put all her photos from her old phone onto her new iphone and deleted all the new ones. We cannot find her new photos. Please help and there was 100 new pics. Is there any way we can get them back. I already have the program Asoftech - but it doesnt seem to register the iphone only C and D drive. Please help!

    bechosken wrote:
    My friend wanted to get some music off my itunes
    This is called "stealing". You do not have the legal right to give her the music you have in your iTunes library unless you are the copyright holder.
    when syncing it it said she had to update her phone software first
    That's not quite what it said.  Someone should have paid more attention to the great big warning about the possibility of losing data if the phone wasn't backed up.
    We cannot find her new photos. Please help and there was 100 new pics. Is there any way we can get them back. I already have the program Asoftech - but it doesnt seem to register the iphone only C and D drive. Please help!
    It restored the backup that was made on your computer 6 months ago, which did not contain those photos. You're wasting your time trying to find them on the phone. They don't exist.
    Hopefully, your friend syncs her phone to her own computer on a regular basis. She needs to plug her phone into her computer and restore it from her last backup. That will restore it to the state it was in when the backup was made.
    She also needs to get in the habit of extracting the photos on a regular basis, like she would from any other digital camera.

  • I am travelling through Europe and fear I have lost all of my photos-.please help asap.

    I have a macpro currently running OS X 10.7.5 
    I thought I updated from iphoto 6 (as recommended) but am unable to find the new version in my downloads and now I am unable to access my photos as when I try to open iphotolibrary6. I get the following message
    Library6.iPhoto The photo library needs to be upgraded to work with this version of iPhoto
    Your photo library will not be readable by previous versions of iPhoto aftr the upgrade. The upgrade process for very large libraries may take an hour or more to complete.
    f I click on 'quit' I am unable to open iPhoto if I click on 'upgrade' this message then appears
    You can't open your current photo library using this version of iPhoto.
    You have made changes to your photo library using a newer version of iphoto. Please quit and use the latest version of iphoto.
    How to do i get the latest version of iphoto when there appear to be no updates available. Confused and very anxious. Please help.

    Cory, you are my hero!!! I found the folder and did as you instructed. All of my bookmarks are back!!! Thanks for saving our marriage! ;)

  • Videos, Photos - Please Help!

    Hi All,
    I've recorded some video, which I've included in my Project. I now want to mix photo's with the video. The video already has audio on it - so the idea is:
    a) Video of me speaking
    b) An image from a photo from iPhoto.
    All the while the photo is displayed, my audio from the video is talking over the image. When the duration of the clip ends - the image is returned to me speaking.
    Basically overlaying an image over a video whilst preserving the audio.
    I managed to do this once! But now I can't do it again What I'm doing is dragging photos over to the project timeline - just like titles.
    The problem is: When playing back the video - the photos aren't being displayed!
    Can anyone please help ? This is for a presentation that I'm putting together for my Thesis.
    Regards,
    Christian.

    managed to do this once! But now I can't do it again What I'm doing is dragging photos over to the project timeline - just like titles... Can anyone please help ? This is for a presentation that I'm putting together for my Thesis.
    Basically you are limited to one (and only one) photo being overlayed to a segment of video (with complete control). So the first thing you probably want to do is split the the video into individual segments where the number of segments is at least the same as the number of photos you wish to "cut" to while you are talking. (I.e., expand the project clip and scrub through it to locate each point where you wish to "split" the main video and then select the split option.) Next, simply drop each photo to the segment where you want it displayed and adjust the in and out points where you want the photo to transition in over the video and back out to the video by simply dragging the left and right edges of the "blue" area representing the dropped photo display duration. Then repeat this as many times as needed.

  • IPhone photos - please help

    I have connected my iPhone to my laptop and I just want to copy the photos from my phone to My Pictures on my laptop. When I click on My Computer the iPhone is not showing up as a camera as I thought I would be able to copy them this way.
    Can anyone help?
    Thanks

    I'm having the exact same problem.
    At one time, i created an album in iPhoto, "upload to iphone", and synced that album to my iPhone.
    Additionally, there is the "Camera Roll" album containing 900+ photos i had taken with my iPhone. (I generally don't check the option in iPhoto to remove photos from the iPhone after importing ... just in case.)
    I wanted to remove all photos from my iPhone (for the first time since i got it!), and i was quite surprised to learn that it is a major operation.
    First, although not specifically asked about in this post, some of you may find this helpful:
    To clear the contents of the iPhone's "Camera Roll", open Image Capture and select your iPhone. Then, select all the photos on the list (or the multiple photos you want) and click the "Delete" icon at the bottom of the screen.
    Next, i wanted to remove my "upload to iphone" album, but when i go to the Photos tab in iTunes during the Sync process, no albums are checked; in fact, the "Sync Photos from..." line isn't checked at all.
    I have tried checking the box, checking the "upload to iphone" album, emptying the contents of that album in iPhoto, and syncing the empty album to the iPhone ... but the photos remain. And, for some reason, i cannot even delete them individually on the iPhone directly because there is not a Trash icon in the bottom right of each photo as there should be!
    Please help...

  • HT1766 I have restored my iphone instead of backing it up and have lost lots of photos, please help?

    Hi,
    I have connected my phone to itunes and restored it instead of backing it up. I have lost about a years worth of photos.
    My apps and notes are still there though.
    please can anyone help me to recover my lost photos?
    Thanks

    Hey
    To answer your question, a restore deletes everything of your iphone/ipod/ipad. Unless you have your photos on your comupter or a memory stick then sorry but you have lost them. Make sure that you back up ur iphone in the future regularly so that you dont lose ur stuff.
    Hope it helps Peter

  • Batch process RAW exposures, please help!

    Hello, I'm new to photoshop scripting for windows, and I was wondering if anyone knew how to batch process a folder of raw files, change the the raw's exposure, and save as jpg to another folder, based on a condition within the file's name, then close the opended jpg  document.
    My goal is to have a script that extracts the correct exposures from sets of three bracketed raw files, which I usually have seperated by 2 EV's.  So for example, say I have a folder Called Batch Processing on the C drive, and I have two folders,
    C:\Batch Processing\JPG
    C:\Batch Processing\RAW
    and in the RAW folder I have some files called,
    Image_01_E01.cr2
    Image_01_E02.cr2
    Image_01_E03.cr2
    If the file has "_E01" at the end, I want to open that raw file, change the exposure to -4, save the file with the same name, except the last 4 characters, and add some number to the end, so for example, it would end up being "Image_01" + "_E01".  This would end up being saved to the JPG folder. Then open up the same file, change the exposure to -2 and save as "Image_01" + "_E02".
    To make this post short, here is the conversion table I'm trying to achieve -
    Image_01_E01.cr2 -> Image_01_E01.jpg Exposure = -4
    Image_01_E01.cr2 -> Image_01_E02.jpg Exposure = -2
    Image_01_E02.cr2 -> Image_01_E03.jpg Exposure = -2
    Image_01_E02.cr2 -> Image_01_E04.jpg Exposure = 0
    Image_01_E02.cr2 -> Image_01_E05.jpg Exposure = 2
    Image_01_E03.cr2 -> Image_01_E06.jpg Exposure = 2
    Image_01_E03.cr2 -> Image_01_E07.jpg Exposure = 4
    After that, close all open files. Then, if there is another set of raws, repeat for them as well. For example -
    Image_02_E01.cr2 -> Image_02_E01.jpg Exposure = -4
    Image_02_E01.cr2 -> Image_02_E02.jpg Exposure = -2
    Image_02_E02.cr2 -> Image_02_E03.jpg Exposure = -2
    Image_02_E02.cr2 -> Image_02_E04.jpg Exposure = 0
    Image_02_E02.cr2 -> Image_02_E05.jpg Exposure = 2
    Image_02_E03.cr2 -> Image_02_E06.jpg Exposure = 2
    Image_02_E03.cr2 -> Image_02_E07.jpg Exposure = 4
    So basically this script would take 3 raws seperated by 2 EV's and extract 7 exposures, seperated by 2 EV's.  I've done this manually, and merged them to hdr, and the results are actually pretty decent. 
    I tried doing this with actions and batch processing, but I had to have everything seperated in individual folders like E01, E02, etc. and I had to make an action for each step in the process.
    I know this is probably a lot to ask, but I think it can be done, and I would of course credit the person in the script for helping.
    Thanks in advance!

    I think I was able to make a function to get the exposure time from the raw's xmp file. So the xmp file has to already be saved with the exposure time in the exif section.
    function getEV(thumb){
        var Name = decodeURI(thumb.name).replace(/\.[^\.]+$/, '');
        var file = new File(thumb.path + "/" + Name + ".xmp");
        try{
            if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
            if(file.exists){
                file.open('r');
                file.encoding = "UTF8";
                file.lineFeed = "unix";
                file.open("r", "TEXT", "????");
                var xmpStr = file.read();
                file.close();
            }else{
                var xmpStr='';
            var xmp = new XMPMeta( xmpStr );
            var exposureTime = xmp.getProperty(XMPConst.NS_EXIF, 'ExposureTime');
            if(exposureTime  == undefined) exposureTime = 1;
        }catch(e){alert(e+"-"+e.line);}
        return exposureTime;
    I was able to use the ui you put together from your hdr script, and used the functions from your cr2 script, to make the raw converter script. I've added a drop down list for the different conversion, and I added an option to either enter the exposure time for the middle exposure, or use the xmp's exposure time instead. So far I've only added a straight conversion method, where the files are converted, without any modifications, the 3 raw, and 5 raw conversion methods. Here's the script -
    #target photoshop
    app.bringToFront();
    main();
    function main(){
        Prefs = {};
        try{
            var desc1 = app.getCustomOptions('0bafbed0-0bc7-11e1-be50-0800200c9a66');
            Prefs = eval(desc1.getString(0));
        }catch(e){
            Prefs.folder1 = Folder("~/desktop");
            Prefs.folder2 = Folder("~/desktop");
            Prefs.bits = false;
        var win = new Window( 'dialog', 'RAW Converter' );
        g = win.graphics;
        var myBrush = g.newBrush(g.BrushType.SOLID_COLOR, [0.91, 0.91, 0.91, 1]);
        g.backgroundColor = myBrush;
        win.orientation = 'row';
        win.p1 = win.add("panel", undefined, undefined, {borderStyle:"etched"});
        win.g1 = win.p1.add('group');
        win.g1.orientation = "row";
        win.title = win.g1.add('statictext',undefined,'RAW to JPEG Converter');
        win.title.alignment = "fill";
        var g = win.title.graphics;
        g.font = ScriptUI.newFont("Georgia","BOLDITALIC",22);
        win.g5 = win.p1.add('group');
        win.g5.orientation = "row";
        win.g5.alignment = 'left';
        win.g5.spacing = 10;
        win.g5.st1 = win.g5.add('statictext',undefined,'Please select input folder');
        win.g10 = win.p1.add('group');
        win.g10.orientation = "row";
        win.g10.alignment = 'left';
        win.g10.spacing = 10;
        win.g10.et1 = win.g10.add('edittext');
        win.g10.et1.preferredSize = [400,20];
        win.g10.et1.enabled = false;
        win.g10.bu1 = win.g10.add('button',undefined,'Browse');
        win.g10.bu1.onClick = function() {
            InputFolder = Folder.selectDialog("Input folder",Prefs.folder1);
            if(InputFolder != null){
                win.g10.et1.text = decodeURI(InputFolder.fsName);
                processHDRList();
        win.g15 = win.p1.add('group');
        win.g15.orientation = "row";
        win.g15.alignment = 'left';
        win.g15.spacing = 10;
        win.g15.st1 = win.g15.add('statictext',undefined,'Please select output folder');
        win.g20 = win.p1.add('group');
        win.g20.orientation = "row";
        win.g20.alignment = 'left';
        win.g20.spacing = 10;
        win.g20.et1 = win.g20.add('edittext');
        win.g20.et1.preferredSize = [400,20];
        win.g20.et1.enabled = false;
        win.g20.bu1 = win.g20.add('button',undefined,'Browse');
        win.g20.bu1.onClick = function() {
            OutputFolder = Folder.selectDialog("Output folder",Prefs.folder2);
            if(OutputFolder != null){
                win.g20.et1.text = decodeURI(OutputFolder.fsName);
        win.g30 = win.p1.add('group');
        win.g30.orientation = "row";
        win.g30.alignment = 'right';
        win.g30.spacing = 10;
        win.g30.st1 = win.g30.add('statictext',undefined,'Please select conversion method');
        win.g30.dd1 = win.g30.add('dropdownlist');
        win.g30.dd1.preferredSize = [200,20];
        var ConversionList = [];
        ConversionList[0] = "Straight Conversion";
        ConversionList[1] = "Bracketed 3x2EV to 7x2EV";
        ConversionList[2] = "Bracketed 5x2EV to 9x2EV";
        for(var x in ConversionList){
            win.g30.dd1.add('item', ConversionList[x].toString());
        win.g30.dd1.selection = 0;
        var ConversionSel = win.g30.dd1.selection.text.toString();
        win.g40 = win.p1.add('group');
        win.g40.orientation = "row";
        win.g40.alignment = 'right';
        win.g40.spacing = 10;
        win.g40.st2 = win.g40.add('statictext',undefined,'Please enter the exif exposure time of middle exposure');
        win.g40.et1 = win.g40.add('edittext',undefined,'1');
        win.g40.et1.preferredSize=[80,20];
        win.g40.et1.enabled = true;
        var TVsel = win.g40.et1.text.toString();
        win.g50 = win.p1.add('group');
        win.g50.orientation = "row";
        win.g50.alignment = 'right';
        win.g50.spacing = 10;
        win.g50.cb1 = win.g50.add('checkbox',undefined,'Use XMP exposure time instead');
        win.g50.cb1.helpTip = "Uses the xmp file's exposure time for the middle exposure instead";
        win.g300 = win.p1.add('group');
        win.g300.orientation = "row";
        win.g300.alignment = 'center';
        win.g300.spacing = 10;
        win.g300.bu1 = win.g300.add('button',undefined,'Process');
        win.g300.bu1.preferredSize = [240,30];
        win.g300.bu2 = win.g300.add('button',undefined,'Cancel');
        win.g300.bu2.preferredSize = [240,30];
        win.g300.bu1.onClick = function(){
            if(win.g10.et1.text == ''){
                alert("Input folder has not been selected!");
                return
            if(win.g20.et1.text == ''){
                alert("Output folder has not been selected!");
                return
            try{
            Prefs.folder1 = InputFolder;
            Prefs.folder2 = OutputFolder;
            var progressBar = function(title) {
                var w = new Window( 'palette', ' '+title, {x:0, y:0, width:340, height:60} ),
                pb = w.add( 'progressbar', {x:20, y:12, width:300, height:12}, 0, 100 ),
                st = w.add( 'statictext', {x:10, y:36, width:320, height:20}, '' );
                st.justify = 'center';
                w.center();
                this.reset = function( msg,maxValue ) {
                    st.text = msg;
                    pb.value = 0;
                    pb.maxvalue = maxValue||0;
                    pb.visible = !!maxValue;
                    w.show();
                this.hit = function() { ++pb.value; };
                this.hide = function() { w.hide(); };
                this.close = function() { w.close(); };
                this.show = function() { w.show(); };
                this.update = function() { w.update(); };
                this.layout = function() { w.layout.layout(); };
            function doPbar(){
                pBar.hit();
                pBar.hide();
                pBar.show();
            var count = 0;
            var group0 = InputFolder.getFiles(/\.(dng|crw|cr2|raw|raf|3fr|dcr|kdc|mrw|nef|nrw|orf|rw2|pef|x3f|srf| sr2)$/i);
            var group1 = InputFolder.getFiles(/\e01.(dng|crw|cr2|raw|raf|3fr|dcr|kdc|mrw|nef|nrw|orf|rw2|pef|x3f|s rf|sr2)$/i);
            var group2 = InputFolder.getFiles(/\e02.(dng|crw|cr2|raw|raf|3fr|dcr|kdc|mrw|nef|nrw|orf|rw2|pef|x3f|s rf|sr2)$/i);
            var group3 = InputFolder.getFiles(/\e03.(dng|crw|cr2|raw|raf|3fr|dcr|kdc|mrw|nef|nrw|orf|rw2|pef|x3f|s rf|sr2)$/i);
            var group4 = InputFolder.getFiles(/\e04.(dng|crw|cr2|raw|raf|3fr|dcr|kdc|mrw|nef|nrw|orf|rw2|pef|x3f|s rf|sr2)$/i);
            var group5 = InputFolder.getFiles(/\e05.(dng|crw|cr2|raw|raf|3fr|dcr|kdc|mrw|nef|nrw|orf|rw2|pef|x3f|s rf|sr2)$/i);
            count += group0.length;
            count += group1.length;
            count += group2.length;
            count += group3.length;
            count += group4.length;
            count += group5.length;
            if (count <1) return;
            if (win.g30.dd1.selection == 0) {
                var pBar = new progressBar("RAW to JPEG Straight Conversion");
                pBar.reset("Processing Files", (group1.length*2));
                for(var a in group0){
                    setEV(group0[a],0);
                    open(group0[a]);
                    var Name = decodeURI(group0[a].name).replace(/\.[^\.]+$/, '');
                    var TVval = TVsel;
                    if (win.g50.cb1.value) TVval = getEV(group0[a]);
                    var exportFile = new File( OutputFolder + "/" + Name + ".jpg" );
                    SaveForWeb(exportFile,100);
                    doPbar();
                    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
                    putXMPData(exportFile,TVval,0);
                pBar.close();
            } else
            if (win.g30.dd1.selection == 1) {
                var pBar = new progressBar("3 RAWs by 2 EV to 7 JPEGs by 2 EV");
                pBar.reset("Processing E01 Files", (group1.length*2));
                for(var a in group1){
                    setEV(group1[a],-4);
                    open(group1[a]);
                    var Name = decodeURI(group1[a].name).replace(/\.[^\.]+$/, '');
                    Name = Name.replace(/e01$/i,'');
                    var TVval = TVsel;
                    if (win.g50.cb1.value) TVval = getEV(group2[a]);
                    var exportFile = new File( OutputFolder + "/" + Name + "E01.jpg" );
                    SaveForWeb(exportFile,100);
                    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
                    putXMPData(exportFile,ExifEV(String(TVval),"1/64"),-6);
                    doPbar();
                    setEV(group1[a],-2);
                    open(group1[a]);
                    var exportFile = new File( OutputFolder + "/" + Name + "E02.jpg" );
                    SaveForWeb(exportFile,100);
                    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
                    putXMPData(exportFile,ExifEV(String(TVval),"1/16"),-4);
                    doPbar();
                pBar.reset("Processing E02 Files", (group2.length*3));
                for(var b in group2){
                    setEV(group2[b],-2);
                    open(group2[b]);
                    var Name = decodeURI(group2[b].name).replace(/\.[^\.]+$/, '');
                    Name = Name.replace(/e02$/i,'');
                    var TVval = TVsel;
                    if (win.g50.cb1.value) TVval = getEV(group2[b]);
                    var exportFile = new File( OutputFolder + "/" + Name + "E03.jpg" );
                    SaveForWeb(exportFile,100);
                    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
                    putXMPData(exportFile,ExifEV(String(TVval),"1/4"),-2);
                    doPbar();
                    setEV(group2[b],0);
                    open(group2[b]);
                    var exportFile = new File( OutputFolder + "/" + Name + "E04.jpg" );
                    SaveForWeb(exportFile,100);
                    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
                    putXMPData(exportFile,TVval,0);
                    doPbar();
                    setEV(group2[b],2);
                    open(group2[b]);
                    var exportFile = new File( OutputFolder + "/" + Name + "E05.jpg" );
                    SaveForWeb(exportFile,100);
                    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
                    putXMPData(exportFile,ExifEV(String(TVval),"4"),2);
                    doPbar();
                pBar.reset("Processing E03 Files", (group3.length*2));
                for(var c in group3){
                    setEV(group3[c],2);
                    open(group3[c]);
                    var Name = decodeURI(group3[c].name).replace(/\.[^\.]+$/, '');
                    Name = Name.replace(/e03$/i,'');
                    var TVval = TVsel;
                    if (win.g50.cb1.value) TVval = getEV(group2[c]);
                    var exportFile = new File( OutputFolder + "/" + Name + "E06.jpg" );
                    SaveForWeb(exportFile,100);
                    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
                    putXMPData(exportFile,ExifEV(String(TVval),"16"),4);
                    doPbar();
                    setEV(group3[c],4);
                    open(group3[c]);
                    var exportFile = new File( OutputFolder + "/" + Name + "E07.jpg" );
                    SaveForWeb(exportFile,100);
                    doPbar();
                    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
                    putXMPData(exportFile,ExifEV(String(TVval),"64"),6);
                pBar.close();
            } else
            if (win.g30.dd1.selection == 2) {
                var pBar = new progressBar("5 RAWs by 2 EV to 9 JPEGs by 2 EV");
                pBar.reset("Processing E01 Files", (group1.length*2));
                for(var a in group1){
                    setEV(group1[a],-4);
                    open(group1[a]);
                    var Name = decodeURI(group1[a].name).replace(/\.[^\.]+$/, '');
                    Name = Name.replace(/e01$/i,'');
                    var TVval = TVsel;
                    if (win.g50.cb1.value) TVval = getEV(group3[a]);
                    var exportFile = new File( OutputFolder + "/" + Name + "E01.jpg" );
                    SaveForWeb(exportFile,100);
                    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
                    putXMPData(exportFile,ExifEV(String(TVval),"1/256"),-8);
                    doPbar();
                pBar.reset("Processing E02 Files", (group2.length*3));
                for(var b in group2){
                    setEV(group2[b],-4);
                    open(group2[b]);
                    var Name = decodeURI(group2[b].name).replace(/\.[^\.]+$/, '');
                    Name = Name.replace(/e02$/i,'');
                    var TVval = TVsel;
                    if (win.g50.cb1.value) TVval = getEV(group3[b]);
                    var exportFile = new File( OutputFolder + "/" + Name + "E02.jpg" );
                    SaveForWeb(exportFile,100);
                    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
                    putXMPData(exportFile,ExifEV(String(TVval),"1/64"),-6);
                    doPbar();
                    setEV(group2[b],-2);
                    open(group2[b]);
                    var exportFile = new File( OutputFolder + "/" + Name + "E03.jpg" );
                    SaveForWeb(exportFile,100);
                    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
                    putXMPData(exportFile,ExifEV(String(TVval),"1/16"),-4);
                    doPbar();
                pBar.reset("Processing E03 Files", (group3.length*3));
                for(var c in group3){
                    setEV(group3[c],-2);
                    open(group3[c]);
                    var Name = decodeURI(group3[c].name).replace(/\.[^\.]+$/, '');
                    Name = Name.replace(/e03$/i,'');
                    var TVval = TVsel;
                    if (win.g50.cb1.value) TVval = getEV(group3[c]);
                    var exportFile = new File( OutputFolder + "/" + Name + "E04.jpg" );
                    SaveForWeb(exportFile,100);
                    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
                    putXMPData(exportFile,ExifEV(String(TVval),"1/4"),-2);
                    doPbar();
                    setEV(group3[c],0);
                    open(group3[c]);
                    var exportFile = new File( OutputFolder + "/" + Name + "E05.jpg" );
                    SaveForWeb(exportFile,100);
                    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
                    putXMPData(exportFile,TVval,0);
                    doPbar();
                    setEV(group3[c],2);
                    open(group3[c]);
                    var exportFile = new File( OutputFolder + "/" + Name + "E06.jpg" );
                    SaveForWeb(exportFile,100);
                    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
                    putXMPData(exportFile,ExifEV(String(TVval),"4"),2);
                    doPbar();
                pBar.reset("Processing E04 Files", (group4.length*3));
                for(var d in group4){
                    setEV(group4[d],2);
                    open(group4[d]);
                    var Name = decodeURI(group4[d].name).replace(/\.[^\.]+$/, '');
                    Name = Name.replace(/e04$/i,'');
                    var TVval = TVsel;
                    if (win.g50.cb1.value) TVval = getEV(group3[d]);
                    var exportFile = new File( OutputFolder + "/" + Name + "E07.jpg" );
                    SaveForWeb(exportFile,100);
                    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
                    putXMPData(exportFile,ExifEV(String(TVval),"16"),4);
                    doPbar();
                    setEV(group4[d],4);
                    open(group4[d]);
                    var exportFile = new File( OutputFolder + "/" + Name + "E08.jpg" );
                    SaveForWeb(exportFile,100);
                    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
                    putXMPData(exportFile,ExifEV(String(TVval),"64"),6);
                    doPbar();
                pBar.reset("Processing E05 Files", (group3.length*2));
                for(var e in group5){
                    setEV(group5[e],4);
                    open(group5[e]);
                    var Name = decodeURI(group5[e].name).replace(/\.[^\.]+$/, '');
                    Name = Name.replace(/e05$/i,'');
                    var TVval = TVsel;
                    if (win.g50.cb1.value) TVval = getEV(group3[e]);
                    var exportFile = new File( OutputFolder + "/" + Name + "E09.jpg" );
                    SaveForWeb(exportFile,100);
                    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
                    putXMPData(exportFile,ExifEV(String(TVval),"256"),8);
                    doPbar();
                pBar.close();
            var desc2 = new ActionDescriptor();
            desc2.putString(0, Prefs.toSource());
            app.putCustomOptions('0bafbed0-0bc7-11e1-be50-0800200c9a66', desc2, true );
            win.close(0);
            }catch(e){alert(e + " - " +e.line);}
        win.center();
        win.show();
        app.displayDialogs = DialogModes.NO;
    function ExifEV(Input,Multiplier) {
        var EVval = Math.abs(eval(Input)*eval(Multiplier)); // Positive Decimal
        var EVvalN = 1; // Numerator
        var EVvalD = 1; // Denominator
        if (EVval < 0.5) EVvalD = Math.floor(1/EVval); else // For values less than 1/2
        // For values greater than 1/2 or values less than 1-1/2, returns 1000ths
        if (EVval < 1 || EVval > 1) {
            EVvalN = Math.floor(EVval*1000);
            EVvalD = 1000;
        } else                                   
        if (EVval > 1.5) EVvalN = Math.floor(EVval); // For values greater than 1-1/2
        return String(EVvalN + "/" + EVvalD); // Return fraction
    function getEV(thumb){
        var Name = decodeURI(thumb.name).replace(/\.[^\.]+$/, '');
        var file = new File(thumb.path + "/" + Name + ".xmp");
        try{
            if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
            if(file.exists){
                file.open('r');
                file.encoding = "UTF8";
                file.lineFeed = "unix";
                file.open("r", "TEXT", "????");
                var xmpStr = file.read();
                file.close();
            }else{
                var xmpStr='';
            var xmp = new XMPMeta( xmpStr );
            var exposureTime = xmp.getProperty(XMPConst.NS_EXIF, 'ExposureTime');
            if(exposureTime  == undefined) exposureTime = 1;
        }catch(e){alert(e+"-"+e.line);}
        return exposureTime;
    function setEV(thumb,evValue){
        var Name = decodeURI(thumb.name).replace(/\.[^\.]+$/, '');
        var file = new File(thumb.path + "/" + Name + ".xmp");
        try{
            if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
            if(file.exists){
                file.open('r');
                file.encoding = "UTF8";
                file.lineFeed = "unix";
                file.open("r", "TEXT", "????");
                var xmpStr = file.read();
                file.close();
            }else{
                var xmpStr='';
            var xmp = new XMPMeta( xmpStr );
            var exposureValue = xmp.getProperty(XMPConst.NS_CAMERA_RAW, "Exposure");
            xmp.deleteProperty(XMPConst.NS_CAMERA_RAW, "Exposure");
            xmp.setProperty(XMPConst.NS_CAMERA_RAW, "Exposure",Number(evValue));
            file.open('w');
            file.encoding = "UTF8";
            file.lineFeed = "unix";
            file.write( xmp.serialize() );
            file.close();
            if(exposureValue  == undefined) exposureValue = 0;
        }catch(e){alert(e+"-"+e.line);}
        return exposureValue;
    function putXMPData(fileName,exposureTime,evValue){
        if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
        var xmpf = new XMPFile(fileName.fsName, XMPConst.FILE_UNKNOWN, XMPConst.OPEN_FOR_UPDATE | XMPConst.OPEN_USE_SMART_HANDLER );
        var xmp = xmpf.getXMP();
        try{
            xmp.setProperty(XMPConst.NS_TIFF, 'Make', 'Canon');
            xmp.setProperty(XMPConst.NS_TIFF, 'Model', 'Canon EOS REBEL T1i');
            xmp.setProperty(XMPConst.NS_EXIF, 'ExposureTime', exposureTime);
            xmp.setProperty(XMPConst.NS_EXIF, 'FNumber', '63/10');
            xmp.setProperty(XMPConst.NS_CAMERA_RAW, 'Exposure',Number(evValue));
            if (xmpf.canPutXMP(xmp)) {
                    xmpf.putXMP(xmp);
                }else{
                    alert(e.message);
                xmpf.closeFile(XMPConst.CLOSE_UPDATE_SAFELY);
        }catch(e){}
    function SaveForWeb(saveFile,jpegQuality) {
        var sfwOptions = new ExportOptionsSaveForWeb();
        sfwOptions.format = SaveDocumentType.JPEG;
        sfwOptions.includeProfile = false;
        sfwOptions.interlaced = 0;
        sfwOptions.optimized = true;
        sfwOptions.quality = jpegQuality;
        activeDocument.exportDocument(saveFile, ExportType.SAVEFORWEB, sfwOptions);
    The script seems to work decent, so I plan on adding the other conversions I mentioned earlier, to it.  If there is a way of getting the exposure time directly from the raw file, please let me know.

Maybe you are looking for

  • Office 2013 Std (local) in combination with Office 2013 Pro (App-V)

    Hello, I have multiple RDS servers, that have Office 2013 Std installed locally. I did this on purpose, after reading some blogs pointing out Office 2013 is a complicated applicatie to stream well. And of course Office 2013 is highly critical to my

  • How to setup rac scan on OEL6 on virtualbox

    I am trying to setup RAC on a 2 node cluster. i am trying to setup rac scan. i have 2 ip address 192.168.8.1 - public  node 1 192.168.8.2 - public  node 2 192.168.1.1 - private node 1 192.168.1.2 - private node 2 VIP Ipaddress 192.168.8.6 192.168.8.7

  • Ask for model qn.

    Hi, i would like to do SAP FICO Certification program. can anybody send me a model certification question paper? pl. send it to my mail id [email protected] it will help for my future. thanks in advance. belated wish u happy new year 2008

  • A dude can't watch my flash movie

    I have the following files: reklame.html reklame.swf AC_RunActiveContent.js The dude are downloading them from http://www.kasperhviid.dk/stuff/reklame.zip However, the dude gets a "The page requires AC_RunActiveContent.js" error. I'm using WinXP, the

  • Xerox Phaser 6110 Not working after lion

    I've updated to Lion but i now cannot print on my networked Xerox Phaser 6100 printer. I know that previously i had to have rosetta installed as per the instuctions on Xerox website and everything worked fine. It's just since the update that it has s