Skip to main content
Known Participant
March 17, 2009
Question

[JS][CS3] Scaling TIFFs

  • March 17, 2009
  • 5 replies
  • 1498 views
Hi,

I need either a solution or someone's pointing me in a right direction...

I have to scale a TIFF file in Ai, so that one of the dimensions occupies a specified value, preserving aspect ratio.

I think that matrix transformation serves that purpose, but I really have not a slightest idea how to do that.
Alternatively, I could get away with knowing the TIFFs dimensions - if there is a quick way to obtain them - preferrably without long-lasting opening it (somewhere from headers?).

Please shed light on which way to go.
Regards.
This topic has been closed for replies.

5 replies

moniuchAuthor
Known Participant
March 21, 2009
Ok xbytor, now that I've checked that it's free for re-deistribution, I will consider your suggestion.
moniuchAuthor
Known Participant
March 20, 2009
Thanks Paul,
While this is good to know such a tool exists, my concern is to depend on Adobe components only. And I'd be really amazed to hear that a function to get img dimensions is not exported by any Adobe DLL :)
"I should've learned to..." write DLLs.

Thanks again.
m.
Known Participant
March 20, 2009
> While this is good to know such a tool exists, my concern is to depend on Adobe components only.

You need realize that this is probably an unreasonable approach.

exiftool is the best tool available on the web for working with metadata. If
Adobe didn't have such a poor interface for adding new classes to the JS
runtime, I would have figured out a way to add the exiftool libraries to Adobe's
JS interpreter(s).

There are things you can do in one line of code with exiftool that would take
100s of lines of code in Bridge/JS or PS/JS. Not using exiftool when it is the
appropriate tool will make your code unnecessarily complex.
Paul Riggott
Inspiring
March 20, 2009
You could use exiftool by Phil Harvey to get the document sizes.
http://www.sno.phy.queensu.ca/~phil/exiftool/
moniuchAuthor
Known Participant
March 20, 2009
Thanks Kasyan, works like a charm! I just modified the code to accept an array of file refs.

Does anyone know whether it's possible (and how) to obtain image dimensions by calling an Adobe DLL rather than calling the Bridge app? I'm pretty sure it'd be faster than waiting for Bridge to launch only to sniff the file.

Does Bridge get installed when a client purchases Illustrator alone?

Regards,
m.
Kasyan Servetsky
Legend
March 18, 2009
I assume that one or more tif-files is/are selected in the Bridge.
var sels = app.document.selections;

var mySize = "";

for (var i = 0; i < sels.length; i++){
var thumb = sels;
var md = thumb.metadata ;
md.namespace = "http://ns.adobe.com/tiff/1.0/";
mySize += thumb.name + "\nPixel Dimentions: " + md["tiff:ImageWidth"] + "x" + md["tiff:ImageLength"] + "\n\n";
}

alert(mySize);


Kasyan