I want to alter the image data of a base64 image.
Altering is in this case encrypting the image data but it can be replace by toUpperCase() for simplicity’s sake.
I get the image data with this code snippet :
let originalImage = myBase64Image let imageData = originalImage.replace(/^data:image/[a-z]+;base64,/, ""); imageData = imageData.toUpperCase()
Altering the imageData does not result in the changing of the original image data.
I was wondering if there way to bring imageData back to a full base64 image that I can use in an html element for example.
Thanks in advance.
Source: JavaSript – Stack OverflowOctober 28, 2021