Extracting and altering base64 image data in javascript

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 Overflow

October 28, 2021
Category : News
Tags: base64 | image | javascript

Leave a Reply

Your email address will not be published. Required fields are marked *

Sitemap | Terms | Privacy | Cookies | Advertising

Senior Software Developer

Creator of @LzoMedia I am a backend software developer based in London who likes beautiful code and has an adherence to standards & love's open-source.