FORUMS: list search recent posts

Batching TIFFs>JPG/PNG w/ automatic resize based on filesizere

COW Forums : Adobe Photoshop

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Daniel Page
Batching TIFFs>JPG/PNG w/ automatic resize based on filesizere
on Dec 9, 2011 at 9:40:31 am

Hi there,

I'm pretty new to all this stuff but I've been doing a LOT of processing of images of late. I'm sure what I want to do can be done with scripts or automation though.

My scenario is this:

I have a folder with a lot of subfolders, many with a bunch of TIFFs inside. Some of these have transparency in them while some don't. These files vary massively in size.

I need all the files to be turned into JPGs, or if they contain transparency, PNGs. I require the files to be 200kb or less and don't really mind how large they are as long as they aren't scaled up.

I spotted this bit of script and was wondering if that might be at least a little useful as a start but I'd much rather learn a little more about how scripting might be able to assist me in this situation.


var SizeOfFile = prompt("Please Enter Size In Megabytes",17)
if (SizeOfFile > 0) resizeToMB( SizeOfFile );

function resizeToMB( size_in_MB ) {
var current_units = preferences.rulerUnits;
preferences.rulerUnits = Units.PIXELS;
var width_pixels = activeDocument.width;
var height_pixels = activeDocument.height;
var channel_count = activeDocument.channels.length;
var final_size = ( 1024 * 1024 * size_in_MB ) / channel_count;
var image_bytes = width_pixels * height_pixels;
var image_scale = Math.sqrt( final_size/ image_bytes );
var final_width = width_pixels * image_scale;
var final_height = height_pixels * image_scale;
var final_dpi = activeDocument.resolution;
if ( image_scale > 1 ) {
activeDocument.resizeImage( final_width, final_height, final_dpi, ResampleMethod.BICUBICSMOOTHER );
} else {
activeDocument.resizeImage( final_width, final_height, final_dpi, ResampleMethod.BICUBICSHARPER );
}
preferences.rulerUnits = current_units;
}

I don't know if you guys could help me but anything you could would be massively appreciated and would totally help me out of this nightmare. I've got around 500GB of data to get through.

Thanks in advance,

Dan


Return to posts index

Jonathan Ziegler
Re: Batching TIFFs>JPG/PNG w/ automatic resize based on filesizere
on Dec 10, 2011 at 11:22:22 pm

Have you tried the code out?

Jonathan Ziegler
http://www.electrictiger.com/
520-360-8293


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]