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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

scripting for images

Status
Not open for further replies.

nevhornsey

Technical User
Mar 3, 2005
5
GB
Hello all,
my question is:
is it possible to create a script for photoshop which resizes individual images or batches of images which:-
a) resizes constrains proportionaly
b) resamples bicubic
c) the only input variable is the output size in megabytes

I would like to resize a lot of images and I want them all to be a 50mb file at the end of the process.
The images have all been captured on high end digital backs but they vary in pixel dimensions.
They are all presently 60mb+ and the agency I want to supply them to only wants images that are 48mb - 50mb

In Photoshop you can specify width, height, resolution but you can not just tell it resize to eg. 48mb etc.

I have had a bit of luck with finding parts of a script but I have no idea how to put the whole lot together in a simple god like Photoshop Script.
The variables I have found so far are:

var x_pixels;
var x_inches;
var x_cm;
var dpi = 72;
var output_memory_size = 51200 * 1024; // 50mb output wanted

x_pixels = Math.sqrt(output_memory_size / 3);
x_inches = x_pixels / dpi;
x_cm = x_inches * 2.54;

If anyone can put these elements into a script that would be fantastic...
cheers,
Nev
 

You should probably ask this in the Photoshop forum, and further specify what version of Photoshop you are talking about.

Hope this helps,
Dan



The answers you get are only as good as the information you give!

 
hi BRPS,
I have asked in the Photoshop forum, to no avail.
The question is a Javascript question really, as it can be used as a script for a hot folder etc. The Photoshop app. is version 8 CS.
I have the variables I just don't know how to write a script.
 

Do you know if there is a scripting API, or some type of user guide for Photoshop Scripting?

JavaScript by itself cannot do image manipulation, so we'd ned to know how to link the script with Photoshop to be able to answer this one.

Dan



The answers you get are only as good as the information you give!

 
Hello again and cheers for discussing this with me.
Here is an example of a photoshop javascrpit which opens a new document:

// Copyright 2002-2003. Adobe Systems, Incorporated. All rights reserved.
// Create a new Photoshop document with diminsions 4 inches by 4 inches.
// Make sure to set the ruler units prior to creating the document.

var strtRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.INCHES;

var newDocumentRef = app.documents.add(4, 4, 72.0, "My New Document");
newDocumentRef = null;

app.preferences.rulerUnits = strtRulerUnits;


////////-- it is then saved as NewDocument.js --///////////

The following is an applescript example ---->>>>

-- Copyright 2002-2003. Adobe Systems, Incorporated. All rights reserved.
-- This script illustrates how to save a document as TIFF with specific options in your Documents folder

tell application "Finder" to set myTempFileName to (home as string) & "Documents:pStest0010.TIFF"

tell application "Adobe Photoshop CS"
make new document

set myOptions to {class:TIFF save options, image compression:none, byte order:Mac OS, save alpha channels:true, save spot colors:true, embed color profile:true}
save current document in file myTempFileName as TIFF with options myOptions appending no extension without copying

end tell

///// then saved as a text file ////
 
The scripts are placed into seperate folders and then in Photoshop you can link to them through the application file finder.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top