Copy link to clipboard
Copied
Hello everyone,
this caught me unexpectedly. Imagine you want to prepare a design as mogrt, which, adapts based on added media image size.
When image is replaced, specific borders appears around the image, ratio specific, dependant on resolution. I setup everything in AE - works as expected. Here things got interesting.
Whenever image is added in Essential Graphics - it fails to read newly replaced image size. Can 100% confim this happens, as adding two text layers pointing to image width/height in AE results them as not being changed in Premiere after image replacement.
Am I missing something, or how come such fundamental thing can fail to work?
Thanks!
This is As Designed and a limitation that was necessary to make the feature work. Workaround has been shared.
Copy link to clipboard
Copied
The Media Replacement Control is bound to the dimensions, duration, and frame rate of the image or video that the control was created with. So there is no way for the frame to match the aspect ratio of the new media even if you had access to it with expressions if you were also trying to use Media Replacement.
This is set in stone and was foundational to get the feature working to begin with so I don’t see it changing any time soon. There are some interesting workarounds that I have heard about that use sampleImage() that look for where the alpha begins to determine a border.
There is a lengthy discussion about the matter here.
and the awesome A.Cobb has shared a solution and sample project on that thread as well. I'll quote here:
Here is a project file with examples of the static and dynamic bounding box detection.
I'm demonstrating this using comps with nested text and shape layers here rather than include footage, but the method is relying entirely on the alpha channels of the resulting comps to measure the bounds.
The very brief version is that for each of the four sides of the bounding box I'm using Minimax and Transform effects to isolate the portion of the comp that is on the empty-alpha side of that boundary. Then I'm using a unidirectional box blur to average the alpha values of the pixels across that divide. That alpha value then represents the ratio of the number of pixels on each side of the boundary. Sample that value with sampleImage, and then the location of the boundary can be calculated through very basic arithmetic. Do this for each of the four boundaries (top, bottom, left, right) and you have the bounding box.
Hope this helps!
Cheers,
Copy link to clipboard
Copied
This is As Designed and a limitation that was necessary to make the feature work. Workaround has been shared.
Copy link to clipboard
Copied
Thanks a lot for sharing, Dacia! I will give this a try and share outcomes in this thread.
What I noticed already is that "media replacement" box in Premiere where media has to be dragged, when hovered, shows "original" image size, thus that was an "oh no" indication :)) Anyways, will take a look, thanks for speedy response!