A script for "Save for Web" as .jpg

I found a script that saves the current selected document in Photoshop as .png to the Desktop, and use it all the time.
function main() {
          // declare local variables
          var doc = app.activeDocument;
          var docName = app.activeDocument.name.slice(0,-4);
    var saveFile = new File("~/Desktop/" + docName + ".png");
    pngSaveOptions = new PNGSaveOptions();
    pngSaveOptions.interlaced = false;
    doc.saveAs(saveFile, pngSaveOptions, true, Extension.LOWERCASE);
main();
Now I'd really like a similar script to do "Save for Web" as .jpg files, without a colour profile, to the Desktop. Preferably a version to save as 100% quality and one to save as 60% quality.
Any help would be greatly appreciated.

Here you are...
function main(){
if(!documents.length) return;
var Name = app.activeDocument.name.replace(/\.[^\.]+$/, '');
var saveFile = File(Folder.desktop + "/" + Name + ".jpg");
if(saveFile.exists){
   if(!confirm("Overwrite existing document?")) return;
    saveFile.remove();
SaveForWeb(saveFile,100); //change to 60 for 60%
main();
function SaveForWeb(saveFile,jpegQuality) {
var sfwOptions = new ExportOptionsSaveForWeb();
   sfwOptions.format = SaveDocumentType.JPEG;
   sfwOptions.includeProfile = false;
   sfwOptions.interlaced = 0;
   sfwOptions.optimized = true;
   sfwOptions.quality = jpegQuality; //0-100
activeDocument.exportDocument(saveFile, ExportType.SAVEFORWEB, sfwOptions);

Similar Messages

  • How to set default preset for Save for Web

    Following the demise of my laptop, I have installed PSE8 (Windows) on my new one.
    On my old machine, the default preset for Save for Web was JPEG High
    On the new installation, the default is GIF and you have to manually scroll through the presets every time to apply the JPEG High preset.
    Is it possible to change the default preset.  If so, how.
    Thank you

    That faq from John R Ellis has not been updated, but may be useful:
    Photoshop Elements 6/7/8 Frequently Asked Questions (FAQ)

  • Photoshop cs6 shortcut for "Save for Web" doesn't work

    I'm using a macbook pro intel i7 2.66 with iOS 10.7.3.
    In photoshop CS6 (which is amazing b.t.w.) when I click the shortcut cmd+alt+shft+S to save for web on the first time it works for me, but then for the rest of the session it never works again.
    After the first time it just opens the "save as..." dialog.
    I've been using photoshop day by day for the last 5 years, and I did try different ways to press the shortcut keys again, to see if its just me... but it wasnt
    Cheers.

    No, it's not that, those works fine.
    it's the shortcut that you can set to change input language, (in preferences > keyboard & mouse > keyboard shortcuts > input menu > select the previous input source/select next input source in the input menu) (currently ctrl+space, but I also tried a few other keys) it used to work before, but after new keyboard software, it doesn't.

  • Call save for web and devices dialog

    can anyone please tell me how to script for call save for web and devices dialog...

    Hi rajaramasami,
    You can find examples e.g. in JavaScript for Save for Web here in forum.
    Here is one, written by Paul Riggott:
    Paul Riggott wrote:
    Here you are...
    function main(){
    if(!documents.length) return;
    var Name = app.activeDocument.name.replace(/\.[^\.]+$/, '');
    var saveFile = File(Folder.desktop + "/" + Name + ".jpg");
    if(saveFile.exists){
       if(!confirm("Overwrite existing document?")) return;
        saveFile.remove();
    SaveForWeb(saveFile,100); //change to 60 for 60%
    main();
    function SaveForWeb(saveFile,jpegQuality) {
    var sfwOptions = new ExportOptionsSaveForWeb();
       sfwOptions.format = SaveDocumentType.JPEG;
       sfwOptions.includeProfile = false;
       sfwOptions.interlaced = 0;
       sfwOptions.optimized = true;
       sfwOptions.quality = jpegQuality; //0-100
    activeDocument.exportDocument(saveFile, ExportType.SAVEFORWEB, sfwOptions);
    Have fun

  • Save for web&.... the image exceeds the size for ....issue with AI on imac i7

    Hi,
    I just upgraded from using macbook Pro to Imac inte core i7 with 4GB. I use illustrator CS3 for high resolution documents i.e saving a Design for say maybe saving for iphone &ipod skin; a quality jpg that is 1300px(width) by 2000px(height.
    General information
    The issue is I keep getting the pop up with:
    The image exceeds the size Save for Web was designed for. You may experience out of memory erros and slow performance. Are you sure you want to continue?
    I click yes, but get another pop up with:
    Could not complete this operation. The rastarized image exceeded the maximum bounds for save for web.
    And last weekend after NOT being able to save anything I went and bought 16GB memory thinking that this ussue would be solved, but nada.
    I have researched around here and google only to find about scratch disk: went to preferences then to plug-ins and scratch Disks -I seem NOT to get to the bottom of this at all.
    And this morning I was trying to create a pattern Design and could not even get the design on the color swatches as I have done before with macbook pro with 4GB -IT'S NOT FUN, because I am NOT doing it right. Do you care to help me out?
    Thanks a whole bunch in advance
    //VfromB

    Are you including a color profile?  What metadata are you including with it?
    How many pixels (h x v)?
    50 kb is not all that big.  Does your image have a lot of detail in it?  Content can affect final compressed size.
    -Noel

  • Colour issue with 'Save for Web' - Photoshop Elements 6 (Mac)

    Cross posted here, but no answer so far. Sorry for cross posting. For me, this is urgent, but I know it's not for anyone else, so apologies for putting 'urgent'.
    http://www.mac-forums.com/forums/images-graphic-design-digital-photography/150670-colour-i ssue-save-web-photoshop-elements-6-a.html#post840419
    This is a similar issue to this:
    Save for web color issue
    Except the user who posted the above was using photoshop cs3, and I'm using Adobe Photoshop Elements 6.
    When I work on a photo, I get it just right, then go to Save for Web, and the original it previews is loads lighter than the orginal I was working on in the first place. See 'Picture 1' attachment.
    I have changed the colour settings on the Save for Web options - I've chosen each one in turn, and none fix the problem.
    There seems to be no similar option in PSE6 to this that fixed it in CS3:
    IN the save for web box there is a small round button with an arrow in it (near the Done button).
    In the list when this button is pressed deselect Convert to sRGB
    I used to use PSE2 on a PC, and never had this problem. I didn't need to mess about with colour profiles or anything similar on the PC. The original was the original, not a washed out version of the original. Why spend ages getting the file just right, only for Save for Web to screw it up?
    Any advice to fix this would be much appreciated.
    Thanks

    Thanks very much for your reply.
    I've uploaded the images here:
    http://jimpix.co.uk/images/Picture 1.jpg
    http://jimpix.co.uk/images/Picture 2.png
    I deleted the prefs. file you suggested, and then opened PSE6.
    I then tried the profile setting you suggested - but it's not an option:
    http://jimpix.co.uk/images/Picture 3.png
    I tried 'remove profile' just in case that worked, but the same effect happens on Save for Web.
    Not sure what to try next!
    Thanks

  • Exporting to PNG vs "Save for Web" in Illustrator CC

    I am creating small logos for a website in Illustrator CC (one is 135px x 50px), and the quality of the output has been a bit sketchy: not blurry or pixelated, but the text is messy and uneven while previewing in Acrobat as part of a larger PDF, and when previewing the logo by itself (I also previewed it in a browser with HTML to get the same unclear image).
    The images have been exported to PNG and JPG at 72 PPI.
    When I experimented with the "save for web" option (File>Save for Web), voila! It fixed the issue! I noticed in the dialogue box for "Save for Web" that it saved as a PNG-24, an option not available to export (you can only export to PNG)
    My question is: is there a difference between "save for web" and exporting that I should know about before I continue to save ALL my images via the "Save for web" option? It seems strange that the best way to save an image (PNG-24) wouldn't be an option under Export (you can only export to PNG). Why can't I export to PNG-24 in Illustrator?
    Thanks for any advice.

    You can save with different color depth, export, it chooses automatically the higher depth when you choose transparent, and the lower depth when you choose a background color.

  • Error message - image exceeds size save for web was designed for

    When I try to Save to Web in Illustrator CS3, I get the following error message: "the image exceeds the size save for web was designed for". Even when I click that I want to go ahead and save it, it sends another error that reads "could not complete this operation. the rasterized image exceeded the maximum bounds for Save for Web".
    Earlier in the day yesterday, I saved for web with no issue. NOw, it doesn't matter how small my design is, it is giving this error.
    Please advise.

    > So in CS3 Save for Web grabs the Artboard, neither the artwork nor the Crop Area/Marks area?
    Creating a new document using "Basic RGB Document" and then "Save for Web & Devices" crops either to the artboard or to the artwork as selected from the "image size" tab in the save-for-web window.
    If your artwork extends beyond the artboard, selecting "clip to artboard" will obviously eliminate everything outside the artboard. Unchecking it will crop the image to the artwork in the file (and thankfully not any artwork that is hidden).
    If you make crop marks in the file, you can choose to either clip to the artboard or not. Not will clip to the crop marks, acting as kind of a secondary artboard.
    ETA:
    You can choose which type of on-screen file type you want your output to be. From GIF, JPG, PNG-8, PNG-24, SWF, SVG, and WBMP. And whether or not you want transparency in those formats that support it.

  • Batch Save for Web using CS5

    Hello All,
    Im trying to process 1200 images that need to be saved for the web.
    I have opend the first images in CS5 which is 84.6kb
    i have then clicked "create new action" -> Shift + Ctrl + Alt + S -> Save (quality 75%)
    then i have stopped the action recording.
    Ive now gone into File -> Automate -> Batch
    In there i have picked the action, the source folder and destination.
    When i run the batch action the images appear in the destination folder but they have not been compressed.
    Any ideas on what i am doing wrong?
    Many thanks

    Download and unzip the script then copy the script to:
    PC: C:\Program Files\Adobe\Adobe Photoshop CS#\Presets\Scripts
    MAC: <hard drive>/Applications/Adobe Photoshop CS#/ Presets/Scripts
    # being the CS version
    To use:-
    File - Scripts - Picture Processor
    Then fill in the fields as required.
    N.B. The last version is the newest with some fixs for Save For Web.
    Hope this helps.

  • Stop Action in Save for Web

    Is it possible to insert a "stop" in the action for save for the web, just before actual save. Basically i want to be able to name my file manually (use distinctive names), but just to automate the picture size option and quality (which don't change). I know that i can write an action for an image resize and than save it with my desired file name, but i was wondering if i can do it all in "one shot" without the altering of original image.

    The best you can do is tell Photoshop to show the save for web dialog box
    and wait you to make your changes and then click on save. It will not put in
    things automatically, you would have to set all options you want. You can
    turn on the dialog box by checking the box next to that step in the actions
    palette list of steps in the action.
    Robert

  • Error when trying to "Save for Web"

    I, like others have the same problem in Photoshop Elements 6 editor when trying to "Save for Web". I get an error: 
    could not complete the export command because of a program error
    I've searched the forum, but it seems like no one has found a solution.
    I have a new PC with Windows 7 on it. It's Win 7 Ultimate 64-bit. i5 processor, 16GB RAM and plenty of HD space.
    I am running Photoshop Elements 6.
    When I used the same version of Photoshop Elements 6 on my old XP computer, I didn't have this problem.
    Adobe Photoshop Elements Language Version: 6.0 (6.0 (20070910.r.377499))
    Operating System: Windows Vista
    Version: 6.1 Service Pack 1
    System architecture: Intel CPU Family:6, Model:10, Stepping:9 with MMX, SSE Integer, SSE FP
    Physical processor count: 4
    Built-in memory: 15822 MB
    Free memory: 11064 MB
    Memory available to Photoshop: 1621 MB
    Memory used by Photoshop: 55 %
    Image cache levels: 6
    Serial number: 10571087952197841429
    Application folder: D:\Program Files\Adobe Photoshop Elements\
    Temporary file path: C:\Users\Roger\AppData\Local\Temp\
    Photoshop scratch has async I/O enabled
    Scratch volume(s):
      C:\, 111.7G, 76.2G free
    Primary Plug-ins folder: D:\Program Files\Adobe Photoshop Elements\Plug-Ins\
    Additional Plug-ins folder: not set
    Installed plug-ins:
       3D Transform 10.0 (10.0x001)
       ADM NO VERSION
       ASDStrm NO VERSION
       Accented Edges 9.0
       Angled Strokes 9.0
       Auto Divide 6.0.0.0 (6.0 (20070910.r.377499))
       Average 10.0 (10.0x001)
       BMP 10.0 (10.0x001)
       Bas Relief 9.0
       Camera Raw 4.2
       Chalk & Charcoal 9.0
       Charcoal 9.0
       Chrome 9.0
       Clouds 10.0 (10.0x001)
       Color Halftone 10.0 (10.0x001)
       Color Variations 10.0 (10.0x001)
       Colored Pencil 9.0
       CompuServe GIF 10.0 (10.0x001)
       Conditional Mode Change 10.0 (10.0x001)
       Conté Crayon 9.0
       Correct Camera Distortion 9.0
       Craquelure 9.0
       Crop and Straighten Photos Filter 10.0 (10.0x001)
       Crosshatch 9.0
       Crystallize 10.0 (10.0x001)
       Cutout 9.0
       Dark Strokes 9.0
       De-Interlace 10.0 (10.0x001)
       Difference Clouds 10.0 (10.0x001)
       Diffuse Glow 9.0
       Displace 10.0 (10.0x001)
       Dry Brush 9.0
       Extrude 10.0 (10.0x001)
       FastCore Routines 10.0 (10.0x001)
       Fibers 10.0 (10.0x001)
       Film Grain 9.0
       Filmstrip 10.0 (10.0x001)
       Filter Gallery 9.0
       Frame From Video 6.0
       Fresco 9.0
       Generic EPS 10.0
       Glass 9.0
       Glowing Edges 9.0
       Grain 9.0
       Graphic Pen 9.0
       Halftone Pattern 9.0
       Ink Outlines 9.0
       JPEG 2000 2.0
       Lens Flare 10.0 (10.0x001)
       Lighting Effects 10.0 (10.0x001)
       Liquify 7.0
       MMXCore Routines 10.0 (10.0x001)
       Magic Extractor 10.0 (10.0x001)
       Matlab Operation 10.0 (10.0x001)
       Mezzotint 10.0 (10.0x001)
       Mosaic Tiles 9.0
       Multiprocessor Support 10.0 (10.0x001)
       NTSC Colors 10.0 (10.0x001)
       Neon Glow 9.0
       Note Paper 9.0
       Ocean Ripple 9.0
       OnEdge 1, 0, 0, 1
       PCX 10.0 (10.0x001)
       PNG 10.0 (10.0x001)
       PNG Icons 1.22x1
       Paint Daubs 9.0
       Palette Knife 9.0
       Patchwork 9.0
       Photocopy 9.0
       PhotomergeUI 10.0 (10.0x001)
       Picture Package Filter 10.0 (10.0x001)
       Pinch 10.0 (10.0x001)
       Pixar 10.0 (10.0x001)
       Plaster 9.0
       Plastic Wrap 9.0
       Pointillize 10.0 (10.0x001)
       Polar Coordinates 10.0 (10.0x001)
       Poster Edges 9.0
       Radial Blur 10.0 (10.0x001)
       Read Watermark 1.70.19
       Reticulation 9.0
       Ripple 10.0 (10.0x001)
       Rough Pastels 9.0
       Save for Web 3.0
       ScriptingSupport 10.0
       Shear 10.0 (10.0x001)
       Smart Blur 10.0 (10.0x001)
       Smudge Stick 9.0
       Solarize 10.0 (10.0x001)
       Spatter 9.0
       Spherize 10.0 (10.0x001)
       Sponge 9.0
       Sprayed Strokes 9.0
       Stained Glass 9.0
       Stamp 9.0
       Straighten Image 10.0 (10.0x001)
       Straighten and Crop Image 10.0 (10.0x001)
       Sumi-e 9.0
       Targa 10.0 (10.0x001)
       Texture Fill 10.0 (10.0x001)
       TextureSelect 10.0 (10.0x001)
       Texturizer 9.0
       Tiles 10.0 (10.0x001)
       Torn Edges 9.0
       Twain Acquire 10.0 (10.0x001)
       Twain Select 10.0 (10.0x001)
       Twirl 10.0 (10.0x001)
       Underpainting 9.0
       WIA Support 10.0 (10.0x001)
       Water Paper 9.0
       Watercolor 9.0
       Wave 10.0 (10.0x001)
       Wind 10.0 (10.0x001)
       Wireless Bitmap 10.0 (10.0x001)
       ZigZag 10.0 (10.0x001)
    Plug-ins that failed to load: NONE
    Installed TWAIN devices:
       WIA-HP Scanjet 4800 series

    I also tried the alt/ctrl/shift buttons when clicking Editor in the Photoshop welcome screen. It did ask if I wanted to reset the preferences. I chose yes. I still get the same error message when trying to save for web.
    Below....showing I don't have a "save for web" folder on my C drive.
    And below, showing the same error after pressing alt/shift/ctrl when clicking on editor and clearing the preferences.
    I don't have a 'Save for Web' folder anywhere on my C: drive. I searched and came up with no folder with the text "save for web" in it.
    I did find a "save for web" folder on my D: drive and deleted that.. but now when I start up Photoshop, the option for Save for Web is grayed out...not able to select it.

  • Save for Web problem

    I am using 'fit artboard to selected items' feature and everything looks as it should be until I try to export them through Save for Web.
    When I do that a one pxl feathered border appears on a file, like in example (border is on left and top of the image).
    I can't seem to find what's wrong, so, pls, help!
    I'm on MAC, using CS 5.1.

    I am saving as .png 24 with transparency and not interlaced.
    However, I tried other formats and I see the same problem in all of them.
    When I look at the borders in Illustrator Workspace I don't see that feather, but I can clearly see it in preview for Save for Web.
    And I also know that it's not the problem with my computer because all other colleagues (there's 8 of us) are having the same issue.
    So, I made another example, using just the plain red square and, while in Artboard Tool, clicked on it and Workspace showed that it bounded to square perfectly, but it's not :/
    Same transparent 1pxl column on the left and top of it.

  • Save for Web causes error in PSE7

    Hi, When I click on Save for Web I get the error message shown below. I have PSE7 and windows 7. I've tried the usual things like deleting the settings file. I have also re-installed the application, however I used the control panel uninstall and then just reinstalled, should I have deleted left over folders etc and may be registry entries. I have also tried the compatibility options in windows 7. No luck!
    Has anyone come across this before, any advice would be well received.
    Thanks   

    Please try allocation more RAM and disk space to PSE. Might be some issue with the same. This kb article should help you there http://kb2.adobe.com/community/publishing/856/cpsid_85658.html
    Not sure but try with admin user also if logged in user on your machine is not admin.
    Also try deleting the preferences file for Save for Web and relaunch PSE C:\Users\[Username]\AppData\Roaming\Adobe\Save For Web PSE
    Let me know your comments.
    -Garry

  • Save for web marks document as modified

    When you save a document for web it considers the document to have been modified and will prompt you to save when closing. This is kind of annoying behavior because the document isn't actually modified; it adds an extra step of dismissing a save dialog and also can put you in doubt as to whether you have actually made unsaved changes.
    My understanding of this 'feature' is that illustrator considers you to have changed the 'export settings' for the document hence the requirement for saving, This would be fine except that it doesn't actually save your export settings, so if you don't want to use the defaults it will continuously prompt you to save the document every single time you export it for web even if you are plugging the same numbers into the export dialog.
    I'd really like to see this fixed, its a small thing but it costs me a lot of time when exporting lots of documents.

    I agree the confusion is annoying to get a save box even if you have not changed any export settings. When printing a document this works fine as I only get an asterisk after the filename, when I change a print setting. Since many people miss the asterisk par twill post a screenshot.
    I am getting different results that you on Mac CS6 for save to web. It appears the ave for web settings are actually within the document such as compression format, number of colors, matter color. Gets quite confusing because when you create a new document it seems to use the last settings used.
    You may want to look into actions if you have a folder of documents needing save for web, as that works well once set up.

  • Save for Web Error, Unique

    In my PS CS5 trial (Mac 64 bit): When attempting to Save for Web, or save a PNG or BMP I am receiving the below error. It is very generic and unlike the others I had been reading about the similar write permission issue.
    In attempt to resolve this issue I have updated Photoshop and even tried Write Permission fixes in vain. I have also gone into the application settings and changed the program to open in 64 bit.
    I have been scouring the forums and the web for someone with this exact problem and have not found a solution. I am not the admin of this machine, but have read + write permissions. Your help is greatly appreciated.

    from adobe:
    you'll have to delete prefs manualy
    Save for Web
    If you try to save  named slices to a directory where that filename already exists,  Photoshop will fail to prompt you with an overwrite warning. You will  silently overwrite the existing file.
    We have removed the shortcut used to delete the preference file for  Save for Web in Photoshop CS5. To manually delete this preference file,  navigate to the following locations and delete the Adobe Save for Web  12.0 Preferences file:          
    Windows XP: C:\Documents and Settings\username\Application Data\Adobe\Save for Web\12.0\Adobe Save for Web 12.0 Prefs          
    Windows Vista or Windows 7: C:\Users\username\AppData\Roaming\Adobe\Save for Web\12.0\Adobe Save for Web 12.0 Prefs          
    Macintosh: Volume\username\Library\Preferences\Adobe Save for Web 12.0 Prefs

Maybe you are looking for