How to add thickness to an 2D image?

Would anyone please tell me how to add thickness to an imported 2D image? In other words, to transfer a 2D image into a 3D object using pure code? I know this can be simply achieved in Blender, but I’m seeking a automatic and pure-code way to convert that. Thank you in advance! Any help is appreciated!

You can extrude the shapre you are using to display the image. The image is a texture, and the texture is applied to a material, which is turn is applied to a mesh. You can create a mesh and extrude it as you wish - Extruding Shapes | Babylon.js Documentation
You could also apply the material to a box and play with the uv coords, or use something similar to this playground -

Thank you for the rapid response! Is there a way to get all the uv coordinates of an image? For example, if I have a png god image with transparent background, can I 1) get the uv of the dog 2) and then extrude it or 3) attach it to a box and manipulate the box’s uv accordingly?

the uv coordinates are of the mesh - if it is a box it is already mapped for you. The image itself is stretched over those uv coordinates

Using the extrude method, is there a way for me to get the uv coordinates of the dog png? So that I can create a shape of the dog, and then extrude it like this PG

I think to get the shape of the dog you need to find the the coordinates of the edge of the dog using where the transparent pixels change to non transparent pixels.