Show image directly from variable data (not from file)

In Corona you can easily show a image on screen using display.newImage.

That function reads the image data from a file.

Let’s say I already have the data of the image inside a variable (let’s say local myImageData), that I read manually using io read function.

Is there a way to show the image that is inside my myImageData variable without having to write the data to a file and use newImage?

Hi Renato,

What do you mean by “data of the image inside a variable”? What kind of data?

The raw image data.

Scenario:

  1. I have a encrypted image file

  2. I read the encrypted file (using io.open, fs:fead) and then decrypt.

  3. Now I have the decryptedImage inside my variable, but I didn’t find a way to already show that raw data directly on screen

  4. So, today I have to save the decrypted image in a file and show the image using display.newImage (wasting 2 i/o operations)

Hi Renato,

No, sorry, we don’t support the processing of raw image data in this way.

Take care,

Brent

Hi Renato,

What do you mean by “data of the image inside a variable”? What kind of data?

The raw image data.

Scenario:

  1. I have a encrypted image file

  2. I read the encrypted file (using io.open, fs:fead) and then decrypt.

  3. Now I have the decryptedImage inside my variable, but I didn’t find a way to already show that raw data directly on screen

  4. So, today I have to save the decrypted image in a file and show the image using display.newImage (wasting 2 i/o operations)

Hi Renato,

No, sorry, we don’t support the processing of raw image data in this way.

Take care,

Brent