Skip to main content
Bruce Bullis
Community Manager
Community Manager
April 28, 2021
Answered

How to extract image dimensions from a PPro projectItem

  • April 28, 2021
  • 2 replies
  • 454 views

Hello all! 

Thanks to an interesting question from a PPro scripter, I've written some example PPro ExtendScript that extracts the dimensions of a projectItem. 

 

 

var kPProPrivateProjectMetadataURI	= "http://ns.adobe.com/premierePrivateProjectMetaData/1.0/";

if (ExternalObject.AdobeXMPScript === undefined) {
	ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
}

var firstItemInProject = app.project.rootItem.children[0];  // make sure first item is media.

if (firstItemInProject) {
    var projectMetadata = firstItemInProject.getProjectMetadata();
	if (projectMetadata) {
		var projectMetadataAsXMP = new XMPMeta(projectMetadata);
		if (projectMetadataAsXMP) {
			var dimensionsFieldName = "Column.Intrinsic.VideoInfo";
			var dimensionsInfo = projectMetadataAsXMP.getProperty(kPProPrivateProjectMetadataURI, dimensionsFieldName);
			if (dimensionsInfo) {
				var widthArray 		= [];
				var heightArray		= [];
				var dimensionsVal 	= dimensionsInfo.value;
				
				var widthEndPos 	= dimensionsVal.indexOf(" ");
				var heightStartPos	= (dimensionsVal.indexOf("x") + 2);
				var heightEndPos 	= dimensionsVal.indexOf("(") - 1;
				
				for (var a = 0; a < widthEndPos; a++) {
					widthArray[a] = dimensionsVal[a];
				}

				for (var b = 0; b < (heightEndPos - heightStartPos); b++) {
					heightArray[b] = dimensionsVal[b + heightStartPos]; // offset to start of height, within source dimension value.
				}

				var widthAsString	= widthArray.join("");	// turn the array into a string, with no separator characters
				var heightAsString	= heightArray.join("");
				
				var width = parseInt(widthAsString);		// turn the string into an int.
				var height = parseInt(heightAsString);

			}
		}
	}
}

 

 

Correct answer bbb_999

I think "Columns.Intrinsic.VideoInfo" is the same, for all languages; does your testing show otherwise?

2 replies

Hey Evgenii
Inspiring
September 1, 2025

Bruce, thank you for sharing, I was wondering this approach works with different premeire pro UI languages rather than English? 

bbb_999
Community Manager
bbb_999Community ManagerCorrect answer
Community Manager
September 2, 2025

I think "Columns.Intrinsic.VideoInfo" is the same, for all languages; does your testing show otherwise?

Hey Evgenii
Inspiring
September 10, 2025

Justed tested, works fine with other languages as well 

arielmartini
Known Participant
April 17, 2023

Thanks, exactly what I was looking for!
The last part could be written like this as well (much simpler):

 

 

if (dimensionsInfo) {
  var val  = dimensionsInfo.value;
  var mid = val.indexOf("x");
  var width = parseInt(val.substr(0, mid));
  var height = parseInt(val.substr(mid + 1));
}