Zoom in or out a 2D image, using only its depth map

Hello everyone!

I want to displace a 2D image on the z axis (zoom in or out). I don’t want to use the displacement Map plugin and just apply some parallax to the 2D image using it’s depth map.
Something like that can be done in Fusion (https://www.youtube.com/watch?v=Fo_5II96Odw&t=500s), but I can’t come up with a way to do it in After effects.
I don’t want to use the well known projection mapping technique with the camera, light and white 3d solids, since the image is complex. It’s not just some planes, where you can get away with traditional After effects projection mapping or Vanishing Point (Photoshop).
I don’t want to use the Projection 3D third party plugin for the same reason.
There must be a way to do this just using the depth map.
It is easy to use the displacement Map plugin and change the perspective of the image. But how can we change the z axis (zoom in/out)? AI tool Stable Diffusion does this just using the depth map. Fusion does it, as well, just using the depth map. How is this done in After effects, though? Certainly, it can be done, but I can’t find how. It must be some other plugin (even a third party one) which can displace the image in the z axis, as well.
If anyone happens to know about this, please share…

Much obliged,

If you can load a bitmap with an alpha channel (or the image and alpha channel could be loaded in 2 separate images) into some programming language software such as the Lazrus IDE or maybe python (maybe AI could help create the code), you could make it read the image with alpha channel and make it output a specified number of output images.

eg. so it could split it into a number of layers (eg. 5 or 10, or in theory more but it would get slow to do or more manual work importing and positioning them if there’s no script to do it in After Effects). So based on the depth map channel for each output image it outputs the pixel values from the source image if the depth map says it’s close enough to be seen in that layer - and if not it outputs in the alpha channel for that layer’s image a pixel value saying it’s fully transparent.

So when it’s split the source bitmap+alpha into the specified number of output images (pngs, that have alpha for transparency values), you should be able to load those into After Effects and position them with the consistently increase z depth amounts (eg. first one at depth 0, then depth 20 then 40, etc.). You might need to increase the scale value of the images as the Z value increases to have it consistent with the original image. So though you said you don’t want to use planes, with enough planes and the right camera movement it should be relatively unnoticeable that it’s a certain amount of planes. eg. if there’s some way in After Effects to import and position each png file created (eg. with a script) then you could split the source image into 100 or 500 output images (planes) or more.