-
insert an image at certain x, y position by position.setValue
I want to insert an image on top of a video at a certain position.
For example, at around bottom left of the video.</p><p>// Set the position and scale of the image to the lower left corner</p><p>function setImagePositionAndScale(clip, sequence) {</p><p> var motionEffect = clip.components[1]; // "Motion" effect</p><p> var position = motionEffect.properties[0]; // "Position" property</p><p><br></p><p> // Get the sequence dimensions</p><p> var seqSettings = sequence.getSettings();</p><p> var seqWidth = seqSettings.videoFrameWidth;</p><p> var seqHeight = seqSettings.videoFrameHeight;</p><p><br></p><p> // Position the image to the lower left corner with a small margin</p><p> var margin = 50; // Adjust margin as needed</p><p><br></p><p> // Directly set the position in pixels</p><p> var xPos = margin;</p><p> var yPos = seqHeight - margin;</p><p> var pValue = position.getValue();</p><p><br></p><p> position.setValue([xPos, yPos], true);</p><p>}<br>
However, when the value of [xPos, yPos] = [50, 310].
After executing, the position value actually becomes [32000.0, 32767.0]
Is there other setting I should consider?
I’ve attached the settings of my sequence as a reference (not sure if it helps)
Thanks