Images are stored at the Sheet (or tab) level, not the cell level. So you have to approach it differently. This seems to work for me:
function getCellImage() {
const sheet = SpreadsheetApp.getActiveSheet();
const images = sheet.getImages()
images.forEach( (img) => {
let anchorCell = img.getAnchorCell().getA1Notation()
if (anchorCell === "D2") {
console.log(img.getUrl())
console.log(img.getAltTextTitle())
console.log(img.getAltTextDescription())
}
})
}