Solved

Action to save multiple gifs from selections

Posted on 2009-03-29
3
431 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction When sharing photos, especially via e-mail, the large resolution images that most cameras take today make for extremely large file sizes. The time required to upload these files to forums, send in e-mails, post to blogs or even placi…
Read about why website design really matters in today's demanding market.
In this Micro Tutorial viewers will learn how to create a CSS image sprite (In a later tutorial, viewers will learn how to use CSS and HTML to create a navigation menu using this sprite) Open a new Photoshop document with a width of (Icon width)x(N…
In this tutorial viewers will learn how to correct colors in Photoshop using the Curves adjustment Open a photo for editing in Photoshop: Begin by creating a new adjustment layer by going to Layer > New Adjustment Layer > Curves: Select "OK" on the …

867 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