Skip to main content
garda86
Participating Frequently
February 25, 2015
Question

AS3 BitmapData to Jpeg to SqlLite database to BitmapData

  • February 25, 2015
  • 1 reply
  • 950 views

Hi,

using AS3, for an AIR application, I have a BitmapData object (obtained from webcam shot). I need to compress the image with JPEGEncoder and save it in a SQLLIte database (string?).

And then I need to re-build the BitmapData object using the data stored in the database.

It's importante the passage of the jpeg compression!

Has someone an idea about how to implement this?

THANK YOU IN ADVACE!

This topic has been closed for replies.

1 reply

kglad
Community Expert
Community Expert
February 26, 2015

the jpegencoder constructor accepts a quality parameter (and you can use the jpegencoderoptions class) to compress the file.

here's more info:  Adobe Flash Platform * Compressing bitmap data

garda86
garda86Author
Participating Frequently
February 26, 2015

Hi, thank you for your reply.

I actually know how to compress an image using JPEGEncoder. What I don't know is how to rebuild the BitmapData starting from the ByteArray obtained by the JPEGEncoder.

Note that I cannot used the UrlLoader, because my jpeg is not stored in the filesystem but in the database (encoding the ByteArray as a String).

Inspiring
February 26, 2015

Encode the ByteArray from the JPEG encoder to a Base64 string and store that. You can then easily rebuild the JPEG from the string... Just Google Base64 to Jpeg AS3 and you'll find all you need.