Scripting a JPEG 'Save As'

I'm doing some work for my company and I need to do what  is essentially stop-motion animation... I have my base .psd file, I move a layer  in it slightly, save it as a .jpeg, and repeat. And repeat, and repeat,  and repeat.
However, it takes way too much time to go through the  'save as' dialogue, change the file name, and change the file type back  to jpeg every time.
I don't know anything at all about  scripts (writing them OR using them), but from what I've read that's  where the solution to my problem lies... a script that will save a jpeg copy of my .psd file with a new name.
In addition to that, it would be AWESOME if that could be set to a key or key combination... like I hit command + ~ and it runs the script.
Can you guys help me?

NB: This is for Photoshop CS3 or better!
Copy and paste the script into ExtendScript Toolkit, this gets installed with Photoshop
This utility can be found in the relevant folder:-
PC: C:\Program Files\Adobe\Adobe Utilities
MAC: <hard drive>/Applications/Utilities/Adobe Utilities
The script needs to be saved into:-
PC: C:\Program Files\Adobe\Adobe Photoshop CS#\Presets\Scripts
NB: Vista and Windows 7 you will have to save it elsewhere and copy it to this folder due to permissions.
MAC: <hard drive>/Applications/Adobe Photoshop CS#/ Presets/Scripts
If Photoshop was open, close and restart Photoshop so that it can pickup the new script.
You can create an action to call the script
Start recording a new action and from the action palette flyout select "Insert Menu Item" then File - Scripts and select the script.
stop the recording.
This action can be given a function key to run it.
Another way is to create your own keyboard shortcut:
Edit - Keyboard Shortcuts - File, go down till you see the script and assign your own shortcut.
On first time use it will let you select the suffix start number.
The files will be saved as OriginalFileName#0001.jpg OriginalFileName#0002.jpg etc..
The files will be saved into the same folder as the original document.
This first script is needed to reset the count back to none, when you want to work on the next document.
app.eraseCustomOptions( 'a7ba92a0-d6f8-11df-937b-0800200c9a66');
This is the main script...
main();
function main(){
if(!documents.length) return;
//Reset Custom Options.
//app.eraseCustomOptions( 'a7ba92a0-d6f8-11df-937b-0800200c9a66' ); return;
Count =0;
try{
var desc1 = app.getCustomOptions('a7ba92a0-d6f8-11df-937b-0800200c9a66');
Count = desc1.getInteger(0);
}catch(e){
var win = new Window("dialog","File increment");
win.pnl1 = win.add('panel');
win.grp1 = win.pnl1.add('group');
win.grp1.st1 = win.grp1.add('statictext',undefined,"File Suffix Number start...");
win.grp1.et1 = win.grp1.add('edittext',undefined,"1");
win.grp1.et1.preferredSize=[50,20];
win.grp1.et1.onChanging = function() {
  if (this.text.match(/[^\-\.\d]/)) {
    this.text = this.text.replace(/[^\-\.\d]/g, '');
win.grp10 = win.pnl1.add('group');
win.grp10.process = win.grp10.add('button',undefined,'Okay');
win.grp10.process.onClick = function(){
    Count = Number(win.grp1.et1.text);
    win.close(1);
win.center();
win.show();
try{
var Name = decodeURI(activeDocument.name).replace(/\.[^\.]+$/, '');
var Path = decodeURI(activeDocument.path);
var saveFile = File(Path + "/" + Name + "#" + zeroPad(Count,4) + ".jpg")
SaveJPEG(saveFile, 8);
Count++;
var desc2 = new ActionDescriptor();
desc2.putInteger(0, Count);
app.putCustomOptions('a7ba92a0-d6f8-11df-937b-0800200c9a66', desc2, true );
}catch(e){alert(e + "\r@ Line " + e.line);}
function SaveJPEG(saveFile, jpegQuality){
var doc = activeDocument;
if (doc.bitsPerChannel != BitsPerChannelType.EIGHT) doc.bitsPerChannel = BitsPerChannelType.EIGHT;
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;

Similar Messages

  • Script command to Save File From Portfolio

    This is the script command to save as, app.execMenuItem("SaveAs")
    What's the script command to Save File From Portfolio?
    Do you know?

    Hi,
    We were looking for that before: Exporting XFA PDF from within Portfolio
    Paul exposed the menu items and while I was hopefully that app.execMenuItem("ExtractFilesFromPackage"); would work - but it didn't.
    It transpires that only a few of the app.execMenuItem commands are unrestricted and available.
    So we continue to use the "open"button on the top right of the portfolio to open the file out of the portfolio:
    I think you are stuck with that,
    Niall

  • Save pdf to folder in JPEG / save aperture book to JPEG

    Hello guys,
    basically I want to save my created photo book in Aperture in the best possible quality.
    I have read the FAQ on apertureexpert.com about "save pdf to folder in JPEG" and have also downloaded the script that was posted their but it did not work as expected.
    http://www.apertureexpert.com/forum-user/post/1306850
    The problem is that I can't really change any settings about the script (like change dpi to 300 like in the video below). Opening it in Automator does not bring the hoped features.
    Basically I want to do exactly what is done in this video:
    http://www.youtube.com/watch?v=VJ7ywI5N9o8
    I might want to export the photos in TIFF too one day!
    I am desperately trying to export my photo book in the best possible quality! I have spend the whole day trying to solve this problem without finding anything on google!
    Would there be any possibilities to just download the complete "Save pdf to folder in TIFF" and "Save pdf to folder in JPEG" script somewhere? That would would be the optimal solution, a download link or simply an upload from someone how as the scripts that originally ware pre-installed on a mac. You can check if you have these under "Macintosh HD/Library/Pdf Services".
    Thanks a lot for your help! I would really appreciate it!
    Best,
    Gordon

    It actually goes thru the motions and appears to be working, but ultimately the pages are not actually created or saved anywhere. I have tried over and over, numerous things, but in the end there are no actual pages created... its weird. I specify exactly where to save the pages, and when its done, there is nothing there....
    Also, when I run the Play button on the "Save PDF to folder as JPEG" in automator, it encounters an error at the "Move Finder Items", the step where it would actually place or save the JPEGs to that location.... I can not seem to figure out what went wrong, as it did work before and I don't know what I could have done to cause an error...

  • Read (get) active document jpeg save quality

    When one creates a jpeg using Save As, the jpeg options dialog box allows one to select a quality level of 1 to 12. When the file is re-opened and saved again using Save As, the original quality value appears in the dialog box. Is there a way to use javascript (or vb or applescript) to read this value for the active document?
    According to the Javascript Scripting Guide, the JPEGSaveOptions for quality are read and write.
    If one uses:
    alert(JPEGSaveOptions.quality), one gets the value 3, which is the default value.
    How do I get the value for the current active jpeg image (document)? Is it possible?
    TIA,
    Tom

    [email protected] wrote:
    >
    > How do I get the value for the current active jpeg image (document)? Is it possible?
    It's actually an Ps-specific exif value. I determined how to get at it other
    than by using exiftool. Ex:
    exiftool -PhotoshopQuality DSCN3255.jpg
    I'll crack open exiftool and see if there's a straightforward way to read it
    directly from the file.
    -X
    for photoshop scripting solutions of all sorts
    contact: [email protected]

  • I need a script that can save images in whatever directory they reside in

    I am working on a project where I have over 1500 directories that have multiple .TIF images in each one. I am looking for a solution where I can run a script (which may or may not call on actions) that allows me to save each .TIF as a .PSD and again as a .PNG (with specific optimization settings) in the same directory as the original .TIF. The main idea here is I need to be able to run the script and walk away. So I'm looking for a one press option for each directory.
    I can create an action that saves the files in the proper format but when I record the action it saves the file in "folder 1". When I run this action again on "folder 2" it saves the images in "folder 1."  I could certainly make adjustments in the "Batch" dialog box by choosing the over ride "save as" function but the goal is to not have to do that 1500 times.
    So, my question is, is there a single script out there that can save images next to the original .TIFFS regardless of what directory the reside in? I'm no scripting guru, but perhaps the code uses something with a "this" command to specify the folder to save images to? Is this even possible? If so, are there web sites I can buy this from? Is there a scripting community that can provide these services?
    Any help to point me in the right direction is much appreciated.
    Mike

    You could try my Picture Processor ...
    http://www.ps-scripts.com/bb/viewtopic.php?f=10&t=3409&sid=3925f7039423a428ed082feba2c0aee 9
    Use the second download.

  • Jpeg "save as copy" does not work

    in CS3, after i'm done adjusting an image with layer and mask, etc, and I go to save it as a jpeg, it automatically attaches "-copy" to the name. I try to do this in CS5 and it doesn't work even though "save as a copy" is checked by default. I have to manually change the file name otherwise it will ask if i want to overwrite the original jpeg and that gets annoying when working with lots of files.  Is this a bug? or is there an easy fix?
    thanks much

    Edit - I just tried this with CS5 and I do get " copy" added to the end of my file name for all but JPEG.
    I'll bet this has something to do with the new feature where you can Save As a JPEG (as a copy) even if you're editing a 16 bit document.
    -Noel

  • Is it possible for me to script Illustrator to save as PDF and attach to email ?

    Hi,
    I am after a script to save my current working file as PDF (with some settings) and then bring up a blank outlook email with that file attached ?
    I do a lot of artwork and have to get it approved, I am getting bored of manually saving to PDF then going to find the file and then clicking send to > mail recipient etc etc
    You know the drill guys.
    So would it be possible for me to just run a script that does all that for me ready to insert the persons name or even add the persons name within the script ?
    thanks
    Lee

    Well, as the kids' paper-crafts book I used to try to put together which frustrated the hell out of me, mockingly read on the bottom of the instructions: "ТЕРПЕНИЕ И ТРУД ВСЕ ПЕРЕТРУТ"
    That is, patience and perseverance will overcome all. 
    To use the below, you've gotta get Autohotkey_L, I believe, and it's not that hard to use.. but it takes some time to learn the various things if you want to write your own ones like this:
    {{YOUR_OWN_HOTKEY_HERE}}::
      MyTempFile = C:\Users\{{YOUR_USER_NAME}}\last_proof_sent.txt
      Run {{YOUR_JSX_SCRIPT}}.jsx                                                  ;Save the PDF proof - the script needs to write a temp text file in a place somewhere, which writes the full name of your saved PDF!
                                                                                                              ; I called my temp text file "last_proof_sent.txt"
      CurrentDateTime := A_Now                                                        ;get current time
      sleep, 500
      FileGetTime, FileTime, %MyTempFile%                                              ;get mod date of this temp file
      TimeCounter = 0                                                                                ;initialize time counter for waiting for PDF to save
      While(CurrentDateTime > FileTime and TimeCounter < 1000)                    ;waiting period to see if temp text file has updated since start of this script
      sleep, 20
      TimeCounter++
      FileGetTime, FileTime, %MyTempFile%                                                      ; each time get the modification date of the temp text file
      If(CurrentDateTime < FileTime){
      FileRead, MyPDFFileName, %MyTempFile%                                                  ;read the contents of temp file for location of PDF file path (It was written there by your JSX script, hopefully)
      If Not ErrorLevel{
      m := ComObjActive("Outlook.Application").CreateItem(0)
      m.Subject := "Greetings to all"                                                                      ; <---- Subject -----
      m.To := "address here"                                                                                    ; <---- Recipient -----
      m.HTMLBody := "email body"                                                                          ; <---- Email message body -----
      m.Display
      m.attachments.add(MyPDFFileName)                                                             ;  This is the attachments!
      } else {
      MsgBox, Error Reading the temporary file %MyTempFile%
      } else {
      MsgBox, "Sorry, action timed-out."
    return
    *** I have tested this on one file where I had a test folder on my desktop.  The ExtendScript likes to put the file path like "~Desktop/", but I used myFile.fsName to get the full "C:/Users/Me..." name in case it was gonna be confusing to AHK.

  • Looking for a script that will save as v11

    I need to save a book and all its files as version 11 (from version 12)

    Hi Dave,
    I have a script that saves to any FM version above 7 (and including MIF format, too). The script optionally copies all images to a local folder and optionally also includes text insets in the save. I know I sent you another script a couple of weeks ago, but I did not keep your email address. If you send the adress to me again I will forward a binary version of the script (the script source is something I am thinking of selling at a later stage and there was a lot of work on it, so I am a little less generous on that).
    Not sure if I have the latest version of the script on my laptop (I am on a business trip this week) but I can send you the script by Saturday at the latest.
    Kind regards from Copenhagen
    Jang

  • Unix Scripting with screen saver

    I have been trying commands from every version of Unix. I cannot find a way to start screen saver from Darwin. I am frustrated. Furthermore, is there a way someone can inform me how to connect to a bluetooth phone using a Mac Address. Similar to "hcitool scan" but for Darwin. So, I am looking for two things from a response from this post. 1) What is the alternative command for "hcitool scan" in Darwin and 2) How do I start my screen saver in Unix?
    Thank you all!

    Wonderful! thank you very much. I will absolutely look into the Mac OS X Technologies forum. Big help!
    I understand freeBSD and Darwin are not entirely equivalent. However, I checked out a book on Unix at the library. That book mentioned a few different versions of Unix including freeBSD. I basically used the book for it's commands and figured out which commands worked in Darwin. That took sometime but it is a long process. Now I am just using the manual pages with the command "man".
    To answer your question, the cocoa application is not for me because I want to learn to program. I saw on YouTube I could program a script easily so I started.
    I've been learning with computers and electronics since I was a young lad (approximately sixth grade for computers and electronics second grade). I learned quickly how much fun these two disciplines could be. In high school my parents pressured me to go into programming but I refused for little reason. Now I recently bought an Apple, after a exploring it a little I found I could download XCode for free. I tried programming in Objective C but my friend advised, "you should learn to program something more simple." so, I tried basic on my TI-86 calculator then I got bored with that and started with Unix. So, here I am learning to code in Unix because of pragmatism (meaning whatever is useful). I have a friend who once knew how to code who is guiding me in my experience. I am hoping to be a computational mathematics major at UCSC. Just waiting for a reply so I am programming to get some skill before I get to my school. I love this stuff!

  • Photoshop in Creative Cloud - no jpeg, save to web, etc

    I recently upgraded to paid subscription for creative cloud (single app/photoshop).  I didn't redownload the app, I merely licensed it, but now when I try to save a file it only allows me to save in psd, raw, tiff, etc.  It will not allow me to convert to jpeg, png, save for web etc on new files I create.  The options are still there on old files from when I did the trial.  What is going on?  If I try to manually change the tag on the image to jpeg, it tells me I have a corrupted file when I try to upload it online.  I'm new to PS so it might just be my own ignorance, but I'm hoping you can help.
    I've tried uninstalling and reinstalling the software but no luck.
    Thanks!

    << Moved to Photoshop Forums >>
    What is the mode of the image you are trying to save ?
    It should be 8 or 16 bits/channel, if its 32 then it will not give you the option to save as JEPG

  • Possible to script palette menus Save and Load Curves?

    Is it possible to script CS4 Photoshop's palette menus? Specifically, the "Save Curves Preset ..." and "Load Curves Preset" ... of the Adjustments Palette.
    I have 600 images, some of which have layer>new adjustment layer>curves applied.
    I want to save the curves using the image name. Later, I want to be able to load the appropriate curve.
    E.g., for image001.tif, the curve would be image001.acv
    (I already have a loop set up to iterate through the files and get the file names.)

    Thank you.
    I got both scripts working without JS or AS errors, but, when trying to load .acv files generated by the second script, CS4 Photoshop gave an error:
    "Could not load the curves because the file is not compatible with this version of Photoshop"
    (The loading script works fine when loading .acv files created directly from Photoshop.)
    The only change I made to your Save Curves code was:
    FROM: var myACV = new File('~/desktop/myCurve.acv')
    TO: var myACV = new File(file);
    and made the code a function:
    saveCurves(file)
    YOUR CODE HERE
    so that I could incorporate it into the Applescript.
    Maybe that was naive (I'm not very knowledgeable about JS).
    Here are the scripts I'm using:
    SAVE CURVES:
    set gammaFolder to "/Users/me/Desktop/myproject/gamma/"
    tell application "Finder"
              set TheFolder to choose folder
              set FileList to every file of entire contents of TheFolder as alias list
    end tell
    repeat with theFile in FileList
              set thefilename to theFile as string
              set text item delimiters to ":"
              set thefilename to last text item of thefilename --remove path
              set text item delimiters to "."
              set thefilename to first text item of thefilename --remove extension
              tell application "Adobe Photoshop CS4"
      activate
      open theFile
                        tell current document
                                  if exists layer "Curves 1" then
                                            set current layer to layer "Curves 1"
                                            do javascript "saveCurves('" & gammaFolder & thefilename & ".acv');
    function saveCurves(file) {
    -- SAVE CURVES JAVASCRIPT HERE
    };" --show debugger on runtime error
                                  end if
                        end tell
              end tell
    end repeat
    LOAD CURVES:
    set gammaFolder to "/Users/me/Desktop/myproject/gamma/"
    tell application "Finder"
              set TheFolder to choose folder
              set FileList to every file of entire contents of TheFolder as alias list
    end tell
    repeat with theFile in FileList
              set thefilename to theFile as string
              set text item delimiters to ":"
              set thefilename to last text item of thefilename --remove path
              set text item delimiters to "."
              set thefilename to first text item of thefilename --remove extension
              set acvFile to gammaFolder & thefilename & ".acv"
              tell application "Finder" to set acvExists to exists my POSIX file acvFile
              if acvExists then
                        tell application "Adobe Photoshop CS4"
      activate
      open theFile
                                  tell current document
                                            if not (exists layer "Curves 1") then
                                                      do action "Create Curve Layer" from "MyActions"
                                            end if
                                            set current layer to layer "Curves 1"
                                            do javascript "loadCurves('" & gammaFolder & thefilename & ".acv');
    function loadCurves(file) {
    -- LOAD CURVES JAVASCRIPT HERE
    };" --show debugger on runtime error
                                  end tell
                        end tell
              end if
    end repeat

  • Script Error on Save

    In Flash CS3, I can make a trivial movie with a single frame
    script as "stop();" and it syntax checks fine. If I save it and
    (without reloading) the syntax check says there are script errors
    listed in the error pane, but it is empty.
    I can load a FLA and it will have the same problem, If I cut
    and paste the script into a new FLA it works great until I save
    then no good...
    This happens EVERY time, so I am completely stuck.

    Hi Ryno,
    We has been through to this error, but i can't give you expalnation why... because when we try to re-simulate we never even close to the root cause.
    your script might loss some how, please back up periodically. just do the restore the script when it shown up.
    cheers and hope helps.

  • "Bogus marker length" exception when jpeg save

    I wrote a program to modified jpeg bytes. Actually quantization tables. But when I save image, I'm getting an IIOException: Bogus marker length.
    InputStream in = new ByteArrayInputStream(b);
    BufferedImage bImageFromConvert = ImageIO.read(in);
    ImageIO.write(bImageFromConvert, "jpg", new File(fname));b - is a byte array, I got it by using toByteArray():
    BufferedImage img = ImageIO.read(new File(filename));
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    JPEGImageEncoder en = JPEGCodec.createJPEGEncoder(baos);
    en.encode(img);
    b = baos.toByteArray();then I modified some bytes. But not markers! and I don't add any extra bytes...
    Exception is:
    javax.imageio.IIOException: Bogus marker length
    at com.sun.imageio.plugins.jpeg.JPEGImageReader.readImageHeader(Native Method)
    at com.sun.imageio.plugins.jpeg.JPEGImageReader.readNativeHeader(JPEGImageReader.java:517)
    at com.sun.imageio.plugins.jpeg.JPEGImageReader.checkTablesOnly(JPEGImageReader.java:272)
    at com.sun.imageio.plugins.jpeg.JPEGImageReader.gotoImage(JPEGImageReader.java:394)
    at com.sun.imageio.plugins.jpeg.JPEGImageReader.readHeader(JPEGImageReader.java:510)
    at com.sun.imageio.plugins.jpeg.JPEGImageReader.readInternal(JPEGImageReader.java:913)
    at com.sun.imageio.plugins.jpeg.JPEGImageReader.read(JPEGImageReader.java:897)
    at javax.imageio.ImageIO.read(ImageIO.java:1422)
    at javax.imageio.ImageIO.read(ImageIO.java:1326)
    Could somebody help me, please?

    Well, the problem is in your code with 99,99% probability.
    I'd probably start debugging this by first just reading and saving the file directly, without any modifications (but go through the conversion to byte array).
    That should definitely work, but if it doesn't then your byte handling is the problem.
    Then I'd add simple modifications incrementally to see where it goes wrong.

  • How do I make a JPEG save as an EPS file?

    Hey everyone,
    I am trying to convert a JPEG into an EPS file for a cloth banner a company is making for my club at school and I have absolutely no idea how to do that. Could anyone please help me?
    Thanks!

    there are probably some GUI apps that will do this (likely Photoshop is one) but if all you need is to convert just one file you can use the terminal command "convert".
    the usage is pretty simple.
    convert path/to/sourcefile path/to/destination/file
    the source file should have .jpg extension and the destination file .eps.
    enter
    man convert
    in terminal for more details.
    to get a path to a file drag it to the terminal window. make sure that the spaces in the command are there as in the example above.
    Message was edited by: V.K.

  • Running script; did not save files

    I made an attempt to batch-process a number of files through the scripts/image processor in CS6. I made the source/destination selections and set the images be saved as a Tiff with no compression. Instead of correctly processed Tiff's, I got a lot of open images that never saved. I tried it by launching image processor from Bridge/tools/photoshop/image processor and Photoshop/file/scripts/image processor. I did complete the task by closing CS6 and using CS5.

    Perhaps a Premiere forum will get you the help you need.

Maybe you are looking for

  • In the year view, why is iCal coloring the boxes?

    In the year view, why is iCal coloring the boxes and what does each color mean and how do we change it?  It makes no sense or has any rhymn or reason according to what is in my calendar.

  • Inbuilt isight camera, light fluctuating

    Hi I began using the inbuilt camera on my brand new imac and record for 1-6 minutes - but during that time the lighting level seems to fluctuate significantly and randomly. I am in evenly distributed artificial light but it seems like thunderclouds a

  • How do I get a stolen Ipod back?

    My iPod has been stolen but I hadn't installed mobileMe or anything and the battery is probably dead now. Any tips?

  • Convert LAT/LONG to X/Y

    Hello all, i've searched this forum to see how I can convert LAT/LONG values to XY coordinates. I've found this: SELECT sdo_geometry(2001, 8307, null, sdo_elem_info_array(1, 1003, 1), sdo_ordinate_array(52.849497, 5.723975, 52.883151, 5.999025)) FROM

  • DVDSP 3 CRASHES While Importing Assets

    Hi There, Having problems with DVDSP 3.02 Will not import assets. Crashes immediately. Here is the log file. Can anyone Help? Date/Time: 2005-10-12 23:27:17.247 -0500 OS Version: 10.4.2 (Build 8C46) Report Version: 3 Command: DVD Studio Pro Path: /Ap