Solved

Action to save multiple gifs from selections

Posted on 2009-03-29
3
430 Views
Last Modified: 2012-05-06
I am looking to select and save gif files from within a document. I need an action that will allow me to create a selection (marque) and the save out that selection as a gif (save for web). The ones I have created wont change the name and therefore overwrites the preceding saved gif.
sample.jpg
0
Comment
Question by:patGRFXS
3 Comments
 
LVL 12

Accepted Solution

by:
alien109 earned 250 total points
ID: 24014495
I tend to lean towards javascript, rather than ps actions for this sort of stuff. If you save the following script to your drive as saveGif.js

/* start */
function exportGif(doc)
{
      saveFile = new File("c:/" + doc.name + ".gif");
      saveOptions = new GIFSaveOptions();
      saveOptions.palette = Palette.LOCALADAPTIVE;
      saveOptions.colors = 128;
      saveOptions.transparency = true;
      saveOptions.matte = MatteType.WHITE;
      doc.saveAs(saveFile, saveOptions, true, Extension.LOWERCASE);
}

var w = app.activeDocument.selection.bounds[2] - app.activeDocument.selection.bounds[0];
var h = app.activeDocument.selection.bounds[3] - app.activeDocument.selection.bounds[1];

app.activeDocument.selection.copy(true);
var newDocumentRef = app.documents.add(w, h, 72.0, prompt("filename?"));
newDocumentRef.paste();
newDocumentRef.flatten();

exportGif(newDocumentRef);
newDocumentRef.close(SaveOptions.DONOTSAVECHANGES);
/* end */

Then create an action in photoshop to run the script: Start record -> File -> Scripts -> Browse and select the saveGif.js script. Assign the action a hotkey, like CTRL f12.

Then make a selection in your document. Press F12. You will be prompted for a filename. Type it in, and blammo.

Note - you might want to change where the image gets saved to by changing the line:

saveFile = new File("c:/" + doc.name + ".gif");

At the moment, it just saves to the root of your C drive.
0
 
LVL 12

Assisted Solution

by:Tony van Schaik
Tony van Schaik earned 250 total points
ID: 24214316
Wouldn't it be easier to use use slices instead of Actions to Save for web. But i depends what you are trying to do? Images from PDF? Or just PSD.
I'm using slices for something like this: http://www.j-learning.org/present_it/page/using_photoshop_slices/
 
 
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

HOW TO CREATE A WEB 2.0 IMAGE WITH A REFLECTION I would like to start by saying I know Web 2.0 isn't a style. It is actually the practice of information sharing or  collaboration on the Web. It is also associated with the technology that is used …
Read about why website design really matters in today's demanding market.
This video will demonstrate how to find the puppet warp tool from the edit menu and where to put the points to edit.
Users will learn how resize a batch of photos from a single command in Photoshop via Photoshop's Image Processor. Open up an Image you'd like to resize in Adobe Photoshop: Adjust the image size according to your preferences. Image > Adjustments > …

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now