Convert base64 code in the body to jpg file in the Postman script

I have a get command that I use to get the photo of a student and then retrieve the photo. I have the student ID as part of teh response back ad the image as base64, how can I convert the base code for the image as a jpg and download automatically, as part of my initial get GET script, or can you recommend another solution to use .

I have tried using this script on the TEST Tab and I got the following message

console.log("PhotoId: " + pm.response.json()[“photoId”]);
console.log("Base64: " + pm.response.json()[“photo”]);

//output in visualize tab
let template = <img src='{{img}}'/>;

pm.visualizer.set(template, {
img: data:image/jpeg;base64,${pm.response.json()["photo"]}

Error Message

There was an error in evaluating the test script: JSONError: Unexpected token ‘<’ at 1:1 <?xml version="1.0" encoding="UTF-8"?> ^

Can you please help