There’s a dedicated After Effects expressions forum [link], but I’ll give it a go here.
Create a new text layer, through in some dummy text, and position and format it as you like. Click the disclosure triangle next to the text layer in the timeline panel, then alt-click the Source Text stopwatch. Enter the following:
i = thisComp.layer("image.jpg");
w = Math.floor(i.width*i.transform.scale[0]/100);
h = Math.floor(i.height*i.transform.scale[1]/100);
w + "x" + h
Of course, change “image.jpg” to match the name of your image layer.
Translated to English:
- Consider “i” shorthand for the image.jpg layer
- Let “w” equal the width of the image.jpg layer, times its scale, divided by 100. Lob off anything after the decimal point so I get a whole number of pixels.
- Likewise for “h” and height.
- Return a text string of the width, the letter x, then the height.
Please note that this will break if you use parenting to affect the scale.
Walter Soyka
Principal & Designer at Keen Live
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
RenderBreak Blog – What I’m thinking when my workstation’s thinking
Creative Cow Forum Host: Live & Stage Events