-
1. Re: change save to jpg to tiff
c.pfaffenbichler Jul 8, 2014 11:53 PM (in response to hhost05)1) Here is an example that should show how to save a tif file.
function saveCopyAsTif (myDocument, thePath) {
// tif options;
tifOpts = new TiffSaveOptions();
tifOpts.embedColorProfile = true;
tifOpts.imageCompression = TIFFEncoding.TIFFLZW;
tifOpts.alphaChannels = false;
tifOpts.byteOrder = ByteOrder.MACOS;
tifOpts.layers = false;
// save copy;
myDocument.saveAs((new File(thePath)), tifOpts, true);
};
2) It’s possible.
-
2. Re: change save to jpg to tiff
hhost05 Jul 8, 2014 11:57 PM (in response to c.pfaffenbichler)c.pfaffenbichler wrote:
1) Here is an example that should show how to save a tif file.
function saveCopyAsTif (myDocument, thePath) {
// tif options;
tifOpts = new TiffSaveOptions();
tifOpts.embedColorProfile = true;
tifOpts.imageCompression = TIFFEncoding.TIFFLZW;
tifOpts.alphaChannels = false;
tifOpts.byteOrder = ByteOrder.MACOS;
tifOpts.layers = false;
// save copy;
myDocument.saveAs((new File(thePath)), tifOpts, true);
};
2) It’s possible.
Thanks for the answer. How is the 2nd part possible?
-
3. Re: change save to jpg to tiff
hhost05 Jul 8, 2014 11:58 PM (in response to hhost05)hhost05 wrote:
c.pfaffenbichler wrote:
1) Here is an example that should show how to save a tif file.
function saveCopyAsTif (myDocument, thePath) {
// tif options;
tifOpts = new TiffSaveOptions();
tifOpts.embedColorProfile = true;
tifOpts.imageCompression = TIFFEncoding.TIFFLZW;
tifOpts.alphaChannels = false;
tifOpts.byteOrder = ByteOrder.MACOS;
tifOpts.layers = false;
// save copy;
myDocument.saveAs((new File(thePath)), tifOpts, true);
};
2) It’s possible.
Thanks for the answer. How is the 2nd part possible?
Thanks a lot for the answer!! How is the 2nd part possible?
-
4. Re: change save to jpg to tiff
c.pfaffenbichler Jul 9, 2014 12:03 AM (in response to hhost05)How is the 2nd part possible?
Please try this (and adapt it as necessary):
var sourceFolder = Folder.selectDialog("Select folder");
var items = retrieveFiles(sourceFolder, []);
alert (items.join("\n"));
////// get from subfolders //////
function retrieveFiles (theFolder, theFiles) {
if (!theFiles) {var theFiles = []};
var theContent = theFolder.getFiles();
for (var n = 0; n < theContent.length; n++) {
var theObject = theContent[n];
if (theObject.constructor.name == "Folder") {
theFiles = retrieveFiles(theObject, theFiles)
};
if (theObject.name.match(new RegExp(/\.(jpe|jpg|jpeg|gif|png|tif|tiff|bmp|psd|dng|pict|eps|raw|rw2|crw|cr2)/i)) != null) {
theFiles = theFiles.concat(theObject)
}
};
return theFiles
};
-
5. Re: change save to jpg to tiff
hhost05 Jul 9, 2014 12:20 AM (in response to c.pfaffenbichler)sorry, i'm a bit new to this. can you embed this new code into the previous script I posted?
-
6. Re: change save to jpg to tiff
c.pfaffenbichler Jul 11, 2014 7:26 AM (in response to hhost05)Please try this:
// 2014 , use it at your own risk;
#target Photoshop
app.bringToFront;
var inFolder = Folder.selectDialog("Please select folder to process");
if(inFolder != null){
var fileList = retrieveFiles (inFolder, []);
var outfolder = new Folder(decodeURI(inFolder) + "/Edited");
if (outfolder.exists == false) outfolder.create();
for(var a = 0 ;a < fileList.length; a++){
if(fileList[a] instanceof File){
var doc= open(fileList[a]);
doc.flatten();
var docname = fileList[a].name.slice(0,-4);
CropStraighten();
doc.close(SaveOptions.DONOTSAVECHANGES);
var count = 1;
while(app.documents.length){
var saveFile = new File(decodeURI(outfolder) + "/" + docname +"#"+ zeroPad(count,3) + ".tif");
saveCopyAsTif(app.activeDocument, saveFile);
activeDocument.close(SaveOptions.DONOTSAVECHANGES) ;
count++;
}
}
}
};
//////
function CropStraighten() {
executeAction( stringIDToTypeID('CropPhotosAuto0001'), undefined, DialogModes.NO );
};
////// get from subfolders //////
function retrieveFiles (theFolder, theFiles) {
if (!theFiles) {var theFiles = []};
var theContent = theFolder.getFiles();
for (var n = 0; n < theContent.length; n++) {
var theObject = theContent[n];
if (theObject.constructor.name == "Folder") {
theFiles = retrieveFiles(theObject, theFiles)
};
if (theObject.name.match(new RegExp(/\.(jpg|jpeg|png|tif|tiff|psd)/i)) != null) {
theFiles = theFiles.concat(theObject)
}
};
return theFiles
};
//////
function saveCopyAsTif (myDocument, thePath) {
// tif options;
tifOpts = new TiffSaveOptions();
tifOpts.embedColorProfile = true;
tifOpts.imageCompression = TIFFEncoding.TIFFLZW;
tifOpts.alphaChannels = false;
tifOpts.byteOrder = ByteOrder.MACOS;
tifOpts.layers = false;
// save copy;
myDocument.saveAs((new File(thePath)), tifOpts, true);
};
//////
function SaveJPEG(saveFile, jpegQuality){
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = jpegQuality;
activeDocument.saveAs(saveFile, jpgSaveOptions, true,Extension.LOWERCASE);
}
//////
function zeroPad(n, s) {
n = n.toString();
while (n.length < s) n = '0' + n;
return n;
};
-
7. Re: change save to jpg to tiff
hhost05 Jul 27, 2014 5:18 AM (in response to c.pfaffenbichler)thank you so much! This works great!
Are there options when saving as tiff like there is with saving as jpg?

