Copy link to clipboard
Copied
Hi all, can anyone please help me to retrieve a scaling value of image in illustrator. How can we identify which scaling has been applied to the image using script. I would like to know how to check whether the image has been applied horizontal scale or vertical scale. Thank you.
Copy link to clipboard
Copied
Hi, I have an issue while retrieving RasterItems(raster image), how can I retrieve the raster image file details? Is there any file property for RasterItems?
Copy link to clipboard
Copied
Hi @SA8888, yes. If the rasterItem has a file property, you can use that. Sometimes a rasterItem does not have a file property, for example when it is pasted into Illustrator, or came from some source that did not have a file.
You can get a rasterItem's file (if it has one) like this:
var doc = app.activeDocument,
item = doc.selection[0];
if (
item.hasOwnProperty('file')
&& item.file.constructor.name === 'File'
&& item.file.exists
) {
// file is good
var f = item.file;
$.writeln('file is good');
$.writeln(f.fsName);
}
-Mark
Copy link to clipboard
Copied
Is it possible to get the file property, if it doesn't contain any?
Copy link to clipboard
Copied
@SA8888 wrote:
Is it possible to get the file property, if it doesn't contain any?
If you have a case where you believe the file or path does exist, send me a sample file and I'm happy to have a look. But the answer is no. Let's say that I copied a graphic and pasted it into an Illustrator document. Which file would you expect to get?
- Mark
Copy link to clipboard
Copied
Hi @m1b how can we retrieve raster image file details like image name, size, location etc..all these things belongs to file property.how can we retrieve all these details without using file property? is there any other way to retrieve those details.
Copy link to clipboard
Copied
Hi @Abpujar, feel free to send me a sample file and I'll see what I can find out. - Mark
Copy link to clipboard
Copied
Hi @m1b in this file I’ve copied image from other document and placed it in illustrator, now the image typename is rasterItem , here I’m not getting file property to this image.(here the image extension is .eps).is there any other way to retrieve the file details without using file property?
Copy link to clipboard
Copied
Hi @Abpujar, I had a good look at the file you posted and there is no trace of file information for it. I looked in the DOM and also in the XMP data. The only thing you could do is to get the pixel dimensions and search for the image using those.
- Mark
P.S. Just checking that you know you can "unembed" a raster image? This will solve the problem in some cases. Choose "unembed" from the Links panel menu.
Copy link to clipboard
Copied
Hi @m1b still I’m confused, is there any script to get the raster image file details (i.e image name, location, size etc)for the pdf which I have shared.
Copy link to clipboard
Copied
There is no file information in the .ai document you posted. The raster image is embedded in the .ai file with no file information. Nothing. I'm happy to clarify any other questions you have about it. - Mark
Copy link to clipboard
Copied
Hi @m1b , how to unembed the RaseterImage using script.
Copy link to clipboard
Copied
Hi @m1b , I’ve tried retrieving scaling script which you have sent. while retrieving scaling details of the PlacedItem . I am having some issue for some images , here I’ve attached document which causes issue. In the document I’ve not applied any scaling but while retrieving scaling details it shows - ve value for vertical scaling. I don’t know what’s wrong with that image ,the script will work fine for other images.
Can you please check on this issue.
Thank you.