Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving files within Action/Bathches to multiple folders

Status
Not open for further replies.

smith385

Technical User
Nov 22, 2006
16
0
0
US
I'm trying to convert images from GIF to JPG.

The thousands GIF files reside in multiple sub-folders. I would like the converted JPGs to be saved in the same folder as the GIF file it originated from.

I've created an action and ran it through the batch process. The files converted to JPG OK, but all the converted files end up saving in one single folder instead of the folders they originated from.

Below is the action I created. I know that the action lists a specific folder to save in and that is why the files all save there, but I don't know how else to record the action "save to web" without selecting the save option.

Action: GIF2JPG
Export
Using: Save For Web
Operation: Save
Format: JPEG
Without Interlaced
Quality: 60
0
Quality Modification Channel Strength: 0
Without Quality Channel Text Layers
Without Quality Channel Vector Layers
With Optimized
Number Of Passes: 1
Blur: 0
Without Embed ICC Profile
With Matte
Matte Color Red: 255
Matte Color Green: 255
Matte Color Blue: 255
Without Save HTML File
With Save Image Files
false
none
true
In: C:\images\folder1
Close
Saving: no

When running the action through the batch process I've selected "None" and "Save & Close" within the destination options. Neither worked.

I saw a save file sript that someone provided within this Photoshop forum, but I don't know what to do with that script.

Please advise.
 
It would be useful to know what vertion of Photoshop you are using.
If you are using PSCS2 PSCS3 the following code would do a whole directory of GIFs.
save the code to a file with a jsx extention to your scripts folder ie:- Gif2Jpg.jsx
pscs2
C:\Program Files\Adobe\Adobe Photoshop CS2\Presets\Scripts
pscs3
C:\Program Files\Adobe\Adobe Photoshop CS3\Presets\Scripts
To run the script Open Photoshop then
File - Scripts - Gif2Jpg
Code:
//Save all GIF files in selected folder as Save For Web jpg files.

var imageFolder = Folder.selectDialog("Select the folder with GIFs to process"); 
if (imageFolder != null) 
{ 
   var fileList = imageFolder.getFiles("*.gif") 
   for (var i = 0; i < fileList.length; i++) 
   { 
   
      if (fileList[i] instanceof File) 
      { 
         open(fileList[i]);          
 var doc = app.activeDocument; 
var docName = app.activeDocument.name.slice(0,-4) + ".jpg";
SaveForWeb(doc.path + "/" + docName),
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES); 
      } 
   } 
} 

function SaveForWeb(JpgFile) {
var sfwOptions = new ExportOptionsSaveForWeb(); 
   sfwOptions.format = SaveDocumentType.JPEG; 
   sfwOptions.includeProfile = false; 
   sfwOptions.interlaced = 0; 
   sfwOptions.optimized = true; 
   sfwOptions.quality = 60; //0-100 
   doc.flatten();
doc.exportDocument(new File(JpgFile), ExportType.SAVEFORWEB, sfwOptions);
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top