Size model based on image target dimensions


I am trying a very simple project where I need to replace a target image with a different image. The problem is I need the replacement image to be the same size as the target image. How do I get the target image dimensions so that my replacement image lies directly overtop the target image.

Thanks in advance!!!

Here is a sample of my code (some code left out for brevity):

const tracker = new ZapparThree.ImageTrackerLoader(manager).load(targetImage);
const trackerGroup = new ZapparThree.ImageAnchorGroup(camera, tracker);

// Add the tracker group to the ThreeJS scene

var loader = new THREE.TextureLoader();
var imgSrc = ‘’;

var material = new THREE.MeshBasicMaterial({
map: loader.load(imgSrc),
side: THREE.DoubleSide,
opacity: 1
var geometry = new THREE.PlaneGeometry(5, 5*.75);
var mesh = new THREE.Mesh(geometry, material);