Current position:  Home > Default > Batch Resize photos Larger than a certain size.

Batch Resize photos Larger than a certain size.

Time:December 10
Is there a way to have a script that searches a directory and any image files that are larger than 1000 x 1000 pixels are resized to 500 x 500 pixels and then saved over righting the sources file?
I am asking because our server has over 40,000 photos all over the place and I would like to reduce the space they take on the server.
I don't think that getting the file's length is the best way to determine if the file needs resizing. Especially if the file is in a format that supports compression. I think you would end up either setting the test value too low and open a lot of files that don't need resizing or set too high and miss files that do.
Also using getFiles() without a file mask will get all files and folders in the source folder. You will need to make sure it is an image file before trying to open in Photoshop to resize.
I think the function below would be a better way to determine if the file needs resizing. It tries to get the XMPMetadata to determine width and height. If that fails because the file does not have metadata it gets the size from Bridge.
var file = new File('~/desktop/_SLP7637.jpg');
var resize = needsResizing( file );
var resizeStr = ''
resize? resizeStr = 'needs resizing': resizeStr = 'does not need resizing';
alert(file.fsName+" "+resizeStr);
function needsResizing( file ){
        var xmpf = new XMPFile( file.fsName, XMPConst.UNKNOWN,
                                   XMPConst.OPEN_FOR_READ );
        var xmp = xmpf.getXMP();
        var dim = xmp.getProperty( XMPConst.NS_EXIF, 'PixelXDimension', XMPConst.STRING)+','+xmp.getProperty( XMPConst.NS_EXIF, 'PixelYDimension', XMPConst.STRING);
        dim = dim.split(',');
            var dim = undefined;
            var res = undefined;
            var bt = new BridgeTalk;
   = "bridge";
            var myScript = ("var ftn = " + psRemote.toSource() + "; ftn("+file.toSource()+");");
            bt.body = myScript;
            bt.onResult = function( inBT ) {myReturnValue(inBT.body); }
            function myReturnValue(str){
                res = str;
                dim = str.split(',');
            function psRemote(file){
                var t= new Thumbnail(file);
                return t.core.quickMetadata.width+','+t.core.quickMetadata.height;
    var res = true;
    if(dim[0]<1001&&dim[1]<1001) res = false;
    return res;
function loadXMPLibrary(){
     if ( !ExternalObject.AdobeXMPScript ){
               ExternalObject.AdobeXMPScript = new ExternalObject
          }catch (e){
               alert( ErrStrs.XMPLIB );
               return false;
     return true;
function unloadXMPLibrary(){
   if( ExternalObject.AdobeXMPScript ) {
         ExternalObject.AdobeXMPScript = undefined;
      }catch (e){
         alert( ErrStrs.XMPLIB );

Can I resize photos and reduce JPEG file sizes by using Photpshop Elements?


Can I resize photos and reduce JPEG file sizes by using Photpshop Elements?Go to Image>Resize>image size. For purpose of web posting, go to File>save for web.Read other 3 answers

IOS 7: Cannot zoom out or resize photo (large) for lock screen. Please Help?


I cannot zoom out or resize a picture because if it being a large picture, I don't want the picture being blocked by the time or date. Anybody help with this issue. With iOS 6 it was fine.It's a glitch. No idea when Apple will release a fix (or if th

Batch resizing of photos in either Bridge of PS?


Hi, I am wondering if anyone can advise or assit me? I have a number of photogrpahs (188) that I need to batch resize (reduce by 50%), is there a way I can do this en mass, either in Bridge or PS so i dont have to open each one indivdually? thanks fo

How do I resize large batches of photos to 640x480 and 97KB?


Greetings, All, I need to learn  how to resize large batches of photos in my iPhoto library, and limit them to 640x480, and a file size of just 97KB.  Can't seem to figure out how to do it in iPhoto, and am thinking about giving Aperture a try, thoug

How do I batch resize 5,000 photos via PS CS4 Extended?


I have 5,000 photos that I took with my Go Pro camera in hopes to make a timelapse movie in Premiere. These photos come out of the camera roughly 1900x1200, and I'm interested in resizing all of them. I know that there are ways to do batch resizing,

Batch Resizing Based On File Size


I have a lot of very large (400-600Mb) tiff files (from a scanner) that all have different ratios (some square, some 4:3, some extreme panoramic). Is there a way I can batch resize them all to a certain file size? (eg 200Mb) I've been looking everywh

Memory consumption issues (when doing large batches of photos)


I have a user who reports my plugin consumes memory until Lr/System is no longer operable, when doing large batches of photos. I have this type of problem too from time to time, but not always, and in the most recent case, *not* for the same operatio

I have Adobe Photoshop 9.  I am a novice.  How can I resize photos in my files using batch resize?


I have Adobe Photoshop 9.  I am a novice.  How can I resize photos in my files using batch resize?In the Editor, use File...Process Multiple Files.  See the Help for more info. KenRead other 2 answers

How to i resize a larger 72ppi image to better quality smaller image but for correct size to paste into flyer


Hi, I am trying to resize a larger 16cm wide image saved at 72dpi to a smaller better quality 5cm wide image for invites for an art exhibition I am having. I figure there must be lots of information in the pic given that it is large, I just want to c

I'm trying to make "Stop motion videos"  in Final Cut EXPRESS by using 100's of still photos and setting them to music.  They are coming out blurry if viewed larger than 4x6 in size


I'm trying to make "Stop motion videos"  in Final Cut EXPRESS by using 100's of still photos and setting them to music.  They are coming out blurry if viewed larger than 4x6 in size. I don't understand why this is happening. Quick follow up, sin

When ordering large batch of photos - "transferring" seemed slow. I hit cancel. Did I lose my order? When I try to "buy photos" again it says "connecting" but doesn't seem to connect...


When I tried to order large batch of photos in iPhoto - it seemed to get stuck halfway through. I hit "cancel". When I tried to "buy" photos again... it never seemed to connect. Did I lose my order? Is it half-uploaded somewhere and I

Can I change an Extra Large photo book to a smaller size once done?


Can I change an Extra Large photo book to a smaller size once done?Sure - butyour text boxes may need work since being a different size may affect the view - to change duplicate the book just in case (select it and press command - D) and then go to t

Batch Resizing within Aperture?


Greetings- I shoot 400-600 images a day, thus I'm beginning to run out of hard drive space. I don't want to create a new vault of pictures on an external drive.  I'm willing to reduce the overall size of my photos in order to create some space on my

Making small photos larger to be used in slide show


I am using Photoshop elements 10 with windows 7 on my Toshiba laptop. I am trying to make a slide show of photos for my brother's funeral. The photos will be shown on a screen at the church and on a TV monitor at home. I was used to Photoshop 4, but

Batch Emailing Photos in iPhoto '08


Hello Emailing a photo or two is cake, as long as having the photo inline in the email is ok. If I wanted to send a batch of photos, say 30 and wanted them 'packaged' in a folder instead of inline in the message, what would be the simplest way of doi

Iweb photo page resizes photos


It seems no matter what I do I cannot get an iweb photo page to NOT resize my photos. On a photo page I have gone to the inspector and selected none and original for the photo download size and iweb still resizes the photos when I publish to a folder

Making sure photos are the exact same size


I am creating before and after photos and need to make sure that each are the same size.  I will have groups of 2 side by side and then groups of 6 with 2 across and 3 down.  Once I create them in layers, is there a way that I can check to make sure

Smart Batch Resizing? vertical/horizontal


Hey, I have a question of how you would batch resize a ton of photos to 50 % of its original size. The workflow I've had before is going trough image processor and doing the resizing when I'm converting to .jpeg. The only problem with image processor

Does photoshop elements enable save for web for a batch of photos?


does photoshop elements enable save for web or ready for web for a batch of photos ?Hi Patonabike, You can batch save images as jpeg, png, tiff etc. using Process Multiple Files. This feature will even allow you to batch resize them (as long as they