Get JPEG data of an image (:jpeg_data)
Declaration
jpeg_data = img:jpeg_data([ quality ])
Parameters
- quality
Number, optional. Image quality, 0.0~1.0. Default 1.0
Returns
- jpeg_data
String. JPEG data. Modifying this data will not affect the image object
Description
Obtain the JPEG data of the image object
Performance: this function copies data twice
Example
-- Save full-screen image with 80% quality (lossy compression)
file.writes('/var/mobile/1.jpg', screen.image():jpeg_data(0.8))
Note: This example uses functions outside this chapter screen.image
, file.writes