Last active
May 19, 2022 20:34
-
-
Save xRyul/967d4c4dacebe556604f1ced864b4e1b to your computer and use it in GitHub Desktop.
Save TIFF with JPEG Compression 10, ZIP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//It overwrites the same image in the current location. Thus run only on Smart Objects!!!!! | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//Photoshop Script to save TIFF as JPEG Compression 10, ZIP. | |
//////////////////////////////////////////////////////////////////////////////////////////// | |
//When run through the Droplet, user will not be prompted which Compression to use when saving transparency and/or together with Smart Objects. | |
//Another workaround was to use PSDs. Which also do not prompt thus allow for easy batching of images. | |
//But PSDs are 2x sometimes 3x bigger in size. Thus slow down the whole batching process. Not to mention those big files slow down, my already super slow machine. | |
//Using TIFF Jpegg 10, ZIP - saves space, runs faster, allows for batching. | |
// Start====================================================== | |
save(10, File( app.activeDocument.path ), true); | |
function save(extendedQuality, In, lowerCase) { | |
var c2t = function (s) { | |
return app.charIDToTypeID(s); | |
}; | |
var s2t = function (s) { | |
return app.stringIDToTypeID(s); | |
}; | |
var descriptor = new ActionDescriptor(); | |
var descriptor2 = new ActionDescriptor(); | |
descriptor2.putEnumerated( s2t( "byteOrder" ), s2t( "platform" ), s2t( "macintosh" )); | |
descriptor2.putEnumerated( s2t( "encoding" ), s2t( "encoding" ), c2t( "JPEG" )); | |
descriptor2.putInteger( s2t( "extendedQuality" ), extendedQuality ); | |
descriptor2.putEnumerated( s2t( "layerCompression" ), s2t( "encoding" ), s2t( "zip" )); | |
descriptor.putObject( s2t( "as" ), c2t( "TIFF" ), descriptor2 ); | |
descriptor.putPath( c2t( "In " ), In ); | |
descriptor.putInteger( s2t( "documentID" ), 219 ); | |
descriptor.putBoolean( s2t( "lowerCase" ), lowerCase ); | |
descriptor.putEnumerated( s2t( "saveStage" ), s2t( "saveStageType" ), s2t( "saveBegin" )); | |
executeAction( s2t( "save" ), descriptor, DialogModes.NO ); | |
} | |
// Finish====================================================== | |
save2(10, File( app.activeDocument.path ), true); | |
function save2(extendedQuality, In, lowerCase) { | |
var c2t = function (s) { | |
return app.charIDToTypeID(s); | |
}; | |
var s2t = function (s) { | |
return app.stringIDToTypeID(s); | |
}; | |
var descriptor = new ActionDescriptor(); | |
var descriptor2 = new ActionDescriptor(); | |
descriptor2.putEnumerated( s2t( "byteOrder" ), s2t( "platform" ), s2t( "macintosh" )); | |
descriptor2.putEnumerated( s2t( "encoding" ), s2t( "encoding" ), c2t( "JPEG" )); | |
descriptor2.putInteger( s2t( "extendedQuality" ), extendedQuality ); | |
descriptor2.putEnumerated( s2t( "layerCompression" ), s2t( "encoding" ), s2t( "zip" )); | |
descriptor.putObject( s2t( "as" ), c2t( "TIFF" ), descriptor2 ); | |
descriptor.putPath( c2t( "In " ), In ); | |
descriptor.putInteger( s2t( "documentID" ), 219 ); | |
descriptor.putBoolean( s2t( "lowerCase" ), lowerCase ); | |
descriptor.putEnumerated( s2t( "saveStage" ), s2t( "saveStageType" ), s2t( "saveSucceeded" )); | |
executeAction( s2t( "save" ), descriptor, DialogModes.NO ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment