Image (image)
image
Image loading, manipulation, QR code generation/decoding, and per-image color/OCR operations. Image buffers are returned by screen.image() or image.load_file().
27 functions
Lua 5.3
image.image.is
image.is(value)Check if a value is an image_buffer userdata.
image.image.load_data
image.load_data(data)Load image from raw binary data (PNG/JPEG).
image.image.load_file
image.load_file(path)Load image from file into image_buffer.
image.image.qr_encode
image.qr_encode(payload [, options])Generate QR code image using nayuki/qrcodegen + CoreGraphics.
image.img:copy
img:copy()Create a copy of the image.
image.img:crop
img:crop(x1, y1, x2, y2)Crop image to region.
image.img:cv_binarization
img:cv_binarization([threshold])Convert image to black and white (in-place). Grayscale then threshold.
image.img:cv_find_image
img:cv_find_image(needle)Template match another image within this image using edge+gray NCC.
image.img:destroy
img:destroy()Destroy image and free memory.
image.img:detect_barcodes
img:detect_barcodes([x1, y1, x2, y2 [, timeout_ms]])Detect barcodes on image.
image.img:find_color
img:find_color(color_table [, similarity] [, x1, y1, x2, y2])Search color pattern on image (same as screen.find_color but on image buffer).
image.img:get_color
img:get_color(x, y)Get pixel color from image.
image.img:get_color_rgb
img:get_color_rgb(x, y)Get pixel R,G,B from image.
image.img:height
img:height()Get image height.
image.img:is_colors
img:is_colors(color_table [, similarity])Check colors on image (same format as screen.is_colors).
image.img:jpeg_data
img:jpeg_data([quality])Get raw JPEG binary data.
image.img:ocr_text
img:ocr_text([x1, y1, x2, y2])OCR on image buffer.
image.img:png_data
img:png_data()Get raw PNG binary data.
image.img:qr_decode
img:qr_decode([x1, y1, x2, y2 [, timeout_ms]])Decode first QR/barcode from image.
image.img:save_to_album
img:save_to_album([timeout_ms])Save image to photo album.
image.img:save_to_jpeg_file
img:save_to_jpeg_file(path [, quality])Save image as JPEG file.
image.img:save_to_png_file
img:save_to_png_file(path)Save image as PNG file.
image.img:size
img:size()Get image dimensions.
image.img:turn_left
img:turn_left()Rotate image 90° counterclockwise.
image.img:turn_right
img:turn_right()Rotate image 90° clockwise.
image.img:turn_upondown
img:turn_upondown()Rotate image 180°.
image.img:width
img:width()Get image width.