How can I encode images into a string?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Darlex
Party member
Posts: 123
Joined: Sun Sep 24, 2017 10:02 am
Location: %_
Contact:

How can I encode images into a string?

Post by Darlex » Mon Jan 27, 2020 5:06 am

Hello again dudes!
I have a question. How do I encode an image into a base64 string to later be decoded into a drawable image?

Code: Select all

while true do me:procrastinate() end

Nelvin
Party member
Posts: 114
Joined: Mon Sep 12, 2016 7:52 am
Location: Germany

Re: How can I encode images into a string?

Post by Nelvin » Mon Jan 27, 2020 6:19 am

You can use imageData:getString and use the result with data.encode to get a base64 encoded string. Later on just reverse the operation with data.decode and image.newImageData

User avatar
AuahDark
Prole
Posts: 46
Joined: Mon Oct 23, 2017 2:34 pm
Location: Indonesia
Contact:

Re: How can I encode images into a string?

Post by AuahDark » Tue Jan 28, 2020 12:28 pm

Profile. I don't always online in forum, so Discord is preferred. Am I LÖVE for Android dev or not? Only you can tell.

Post Reply

Who is online

Users browsing this forum: No registered users and 24 guests