Article View: adobe.photoshop.scripting
Article #435Re: strip exif
From: Paul_R
Date: Wed, 28 Jan 2009 23:13
Date: Wed, 28 Jan 2009 23:13
86 lines
2462 bytes
2462 bytes
I would have suggested using Exiftool but that has problems with tif files.
This is another way, copy and paste to a new document and save the new document as a tif. This has it's own problems if you want to retain layers/alpha channels etc. Anyway here is a script that should do a folder of tifs.....
var sourceFolder = Folder.selectDialog("Select the folder to process");
var outputFolder = Folder.selectDialog("Select Output folder");
if (sourceFolder != null)
{
var fileList = sourceFolder.getFiles("*.tif")
for (var i = 0; i < fileList.length; i++)
{
displayDialogs = DialogModes.NO;
if (fileList[i] instanceof File)
{
open(fileList[i]);
var startRulerUnits = preferences.rulerUnits;
preferences.rulerUnits = Units.PIXELS;
var doc = app.activeDocument;
var docName = app.activeDocument.name;
var saveFile =new File(outputFolder + "/" + docName);
doc.selection.selectAll();
doc.selection.copy();
var W = activeDocument.width.value;
var H = activeDocument.height.value;
var R = activeDocument.resolution;
var MODE = app.activeDocument.mode;
var doc2 = app.documents.add(W, H, R, "Untitled-"+(documents.length+1), eval("New"+MODE), DocumentFill.WHITE,1.0);
doc.close(SaveOptions.DONOTSAVECHANGES);
doc2.paste();
doc2.flatten();
SaveTIFF(saveFile);
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
app.preferences.rulerUnits = startRulerUnits;
}
}
}
function SaveTIFF(saveFile){
tiffSaveOptions = new TiffSaveOptions();
tiffSaveOptions.embedColorProfile = true;
tiffSaveOptions.alphaChannels = true;
tiffSaveOptions.imageCompression = TIFFEncoding.TIFFLZW;
activeDocument.saveAs(saveFile, tiffSaveOptions, true, Extension.LOWERCASE);
}
Technical Details
Message-ID:
<59b7b6fd.0@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!newshub.sdsu.edu!webcrossingReferences:
<59b7b6fd.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f5839,395b07c7068cc51 X-Google-Attributes: gidf5839,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Paul_R@adobeforums.com Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.photoshop.scripting Subject: Re: strip exif Message-ID: <59b7b6fd.0@webcrossing.la2eafNXanI> Date: Wed, 28 Jan 2009 15:13:49 -0800 References: <59b7b6fd.-1@webcrossing.la2eafNXanI> Lines: 53 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit