Solved

Action to save multiple gifs from selections

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this article, I'll explain how to change the color of a selection in Photoshop. I'm sure there are a couple different ways to do this in photoshop, but this is my preferred method in Photoshop. I am using Photoshop CS6 and I will be adjusting the…
Read about why website design really matters in today's demanding market.
In this tutorial viewers will learn a few layer organization tricks and tips to improve their workflow in Photoshop. Open a multi-layer document in Photoshop: View all your layers by going Window > Layers:  To make sure your layers can be identified…
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

808 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