Copy link to clipboard
Copied
Can I get the size of the image before importing it into Illustrator? for example, if I have five images on drive "c:\test" and I want to import the smallest one, is it possible to do it?
Copy link to clipboard
Copied
Size is an ambivalent term in this context; do you mean size as in x MB or as in x mm by x mm?
What is the images’ file format?
Copy link to clipboard
Copied
If you're referring to your source files, just click once on them in Windows Explorer or Apple Finder window, depending on your platform, then right-click on them and select Properties (Windows) or Get Info (Mac).
From there, you'll be able to determine, by filesize and by resolution, which version of the file best suits your needs before you import it into Illustrator.
Hope this helps,
Randy
Copy link to clipboard
Copied
// get files (e.g. JPGs) in folder "Test" in "Desktop"
// remove or modify filter ("*.jpg") as required
var folder1 = new Folder("~/Desktop/Test");
var files = folder1.getFiles("*.jpg");
// sort files by size (bytes), from smallest to largest
files.sort(function(a, b) {return a.length - b.length;})
// place smallest file in open document
var pic1 = app.activeDocument.placedItems.add();
pic1.file = files[0];