Copy link to clipboard
Copied
Hi All,
I have AI and PDF images, I need to get bounding box values like photoshop application getting these values (shown in below screenshots).
The .ai image actual width and height are 612 and 792 respectively. This is includes artboard also. I need to get bounding box of the image. If I select bounding box option in the drop down, It shows the width and height are 401 and 473 respectively.
I am struct here to get exact bounding box values for .ai/.pdf images without opening Photoshop application.
Is it possible to get the bounding box values from .ai/.pdf images?
Thanks.
Copy link to clipboard
Copied
"The .ai image actual width and height are 612 and 792 respectively."
Hi
I am not a scripter, but I do have a question for you on the numbers you are looking for. Do you want the width and height for the vector paths or the paths with their appearances? I copied this next paragraph from Help for you. If you get a script that works, you'll need to determine which set of values you are seeking.
"When an object is selected and a selection tool is active, the Info panel displays the object’s x and y coordinates, width (W), and height (H). The values for width and height are affected by the Use Preview Bounds option in the General preferences. When Use Preview Bounds is selected, Illustrator includes the stroke width (and other attributes such as drop shadows) in the object’s dimensions. When Use Preview Bounds is cleared, Illustrator measures only the dimensions defined by the object’s vector path."
~ Jane
Copy link to clipboard
Copied
Perhaps look at the work of the master:
https://raw.githubusercontent.com/Paul-Riggott/PS-Scripts/master/PDF%20ProcessorII.jsx
As for the PDF, this metadata is in the native PostScript Points unit of measure. You can get this from the PDF, you may possibly need to use BridgeTalk?
The following Acrobat Reader/Acrobat Pro script shows the common page boxes:
function ThePageSize(){
var aRect = this.getPageBox("Crop",this.pageNum);
var aWidth = aRect[2] - aRect[0];
var aHeight = aRect[1] - aRect[3];
var bRect = this.getPageBox("Art",this.pageNum);
var bWidth = bRect[2] - bRect[0];
var bHeight = bRect[1] - bRect[3];
var cRect = this.getPageBox("Trim",this.pageNum);
var cWidth = cRect[2] - cRect[0];
var cHeight = cRect[1] - cRect[3];
var dRect = this.getPageBox("Bleed",this.pageNum);
var dWidth = dRect[2] - dRect[0];
var dHeight = dRect[1] - dRect[3];
var eRect = this.getPageBox("Media",this.pageNum);
var eWidth = eRect[2] - eRect[0];
var eHeight = eRect[1] - eRect[3];
var pageLabel = this.pageNum + 1;
var totalPages = this.numPages;
app.alert("Page: " + pageLabel + " of " + totalPages + " pages" + "\n\n" + ("Crop: " + Math.round(aWidth*0.3528*100)/100 + " mm x " + Math.round(aHeight*0.3528*100)/100 + " mm" + "\n\n" + ("Art: " + Math.round(bWidth*0.3528*100)/100 + " mm x " + Math.round(bHeight*0.3528*100)/100 + " mm") + "\n\n" + ("Trim: " + Math.round(cWidth*0.3528*100)/100 + " mm x " + Math.round(cHeight*0.3528*100)/100 + " mm") + "\n\n" + ("Bleed: " + Math.round(dWidth*0.3528*100)/100 + " mm x " + Math.round(dHeight*0.3528*100)/100 + " mm") + "\n\n" + ("Media: " + Math.round(eWidth*0.3528*100)/100 + " mm x " + Math.round(eHeight*0.3528*100)/100 + " mm")));
}
app.addMenuItem ({cName: "Show PageBox Sizes", cParent: "View", cExec: "ThePageSize()" });
P.S.: The other box is the bounding box or BBox, however, I have had inconsistent results with this data:
https://www.pdfscripting.com/public/PDF-Page-Coordinates.cfm
This link may shed some light on the topic:
Copy link to clipboard
Copied
Thanks for your reply Jane & Stephen..
Here I need to get bounding box values without opening photoshop/Acrobat application. Is it possible to get values through terminal (command line options)?
I need to get bounding box values and convert .ai to .jpg image. I tried manually in photoshop, Open with bounding box open options and export as JPG image. Thats why I need bounding box value for this images. In Photoshop only to fetch bounding box calculation correctly for .ai images.
Thanks.
Copy link to clipboard
Copied
Also I tried in ImageMagick tool, It is not converting properly for .ai and .pdf images. It keeps the whitespace (artboard) in the images. If I select -trim options, It completely removes whitespace in the images.
But I need Photoshop functionality to convert .ai to .jpg with bounding box option.