On this page
hs.image
A module for capturing and manipulating image objects from other modules for use with hs.drawing.
API Overview
- Constants - Useful values which cannot be changed
- Functions - API calls offered directly by the extension
- Constructors - API calls which return an object, typically one that offers API methods
- iconForFile
- iconForFileType
- imageFromAppBundle
- imageFromASCII
- imageFromMediaFile
- imageFromName
- imageFromPath
- imageFromURL
- Methods - API calls which can only be made on an object returned by a constructor
API Documentation
Constants
additionalImageNames
Signature | hs.image.additionalImageNames[] |
---|---|
Type | Constant |
Description | Table of arrays containing the names of additional internal system images which may also be available for use with |
Notes |
|
Source | extensions/image/libimage.m line 283 |
systemImageNames
Signature | hs.image.systemImageNames[] |
---|---|
Type | Constant |
Description | Table containing the names of internal system images for use with hs.drawing.image |
Notes |
|
Source | extensions/image/libimage.m line 131 |
Functions
getExifFromPath
Signature | hs.image.getExifFromPath(path) -> table | nil |
---|---|
Type | Function |
Description | Gets the EXIF metadata information from an image file. |
Parameters |
|
Returns |
|
Source | extensions/image/libimage.m line 759 |
Constructors
iconForFile
Signature | hs.image.iconForFile(file) -> object |
---|---|
Type | Constructor |
Description | Creates an |
Parameters |
|
Returns |
|
Source | extensions/image/libimage.m line 1097 |
iconForFileType
Signature | hs.image.iconForFileType(fileType) -> object |
---|---|
Type | Constructor |
Description | Creates an |
Parameters |
|
Returns |
|
Source | extensions/image/libimage.m line 1132 |
imageFromAppBundle
Signature | hs.image.imageFromAppBundle(bundleID) -> object |
---|---|
Type | Constructor |
Description | Creates an |
Parameters |
|
Returns |
|
Source | extensions/image/libimage.m line 1068 |
imageFromASCII
Signature | hs.image.imageFromASCII(ascii[, context]) -> object |
---|---|
Type | Constructor |
Description | Creates an image from an ASCII representation with the specified context. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/image/libimage.m line 838 |
imageFromMediaFile
Signature | hs.image.imageFromMediaFile(file) -> object |
---|---|
Type | Constructor |
Description | Creates an |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/image/libimage.m line 1154 |
imageFromName
Signature | hs.image.imageFromName(string) -> object |
---|---|
Type | Constructor |
Description | Returns the hs.image object for the specified name, if it exists. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/image/libimage.m line 986 |
imageFromPath
Signature | hs.image.imageFromPath(path) -> object |
---|---|
Type | Constructor |
Description | Loads an image file |
Parameters |
|
Returns |
|
Source | extensions/image/libimage.m line 811 |
imageFromURL
Signature | hs.image.imageFromURL(url[, callbackFn]) -> object |
---|---|
Type | Constructor |
Description | Creates an |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/image/libimage.m line 1016 |
Methods
bitmapRepresentation
Signature | hs.image:bitmapRepresentation([size], [gray]) -> imageObject |
---|---|
Type | Method |
Description | Creates a new bitmap representation of the image and returns it as a new hs.image object |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/image/libimage.m line 1662 |
colorAt
Signature | hs.image:colorAt(point) -> table |
---|---|
Type | Method |
Description | Reads the color of the pixel at the specified location. |
Parameters |
|
Returns |
|
Source | extensions/image/libimage.m line 1315 |
copy
Signature | hs.image:copy() -> imageObject |
---|---|
Type | Method |
Description | Returns a copy of the image |
Parameters |
|
Returns |
|
Source | extensions/image/libimage.m line 1613 |
croppedCopy
Signature | hs.image:croppedCopy(rectangle) -> object |
---|---|
Type | Method |
Description | Returns a copy of the portion of the image specified by the rectangle specified. |
Parameters |
|
Returns |
|
Source | extensions/image/libimage.m line 1347 |
encodeAsURLString
Signature | hs.image:encodeAsURLString([scale], [type]) -> string |
---|---|
Type | Method |
Description | Returns a bitmap representation of the image as a base64 encoded URL string |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/image/libimage.m line 1397 |
name
Signature | hs.image:name([name]) -> imageObject | string |
---|---|
Type | Method |
Description | Get or set the name of the image represented by the hs.image object. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/image/libimage.m line 1252 |
saveToFile
Signature | hs.image:saveToFile(filename, [scale], [filetype]) -> boolean |
---|---|
Type | Method |
Description | Save the hs.image object as an image of type |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/image/libimage.m line 1487 |
setName
Signature | hs.image:setName(Name) -> boolean |
---|---|
Type | Method |
Description | Assigns the name assigned to the hs.image object. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/image/image.lua line 39 |
setSize
Signature | hs.image:setSize(size [, absolute]) -> object |
---|---|
Type | Method |
Description | Returns a copy of the image resized to the height and width specified in the size table. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/image/image.lua line 53 |
size
Signature | hs.image:size([size, [absolute]] ) -> imageObject | size |
---|---|
Type | Method |
Description | Get or set the size of the image represented by the hs.image object. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/image/libimage.m line 1280 |
template
Signature | hs.image:template([state]) -> imageObject | boolean |
---|---|
Type | Method |
Description | Get or set whether the image is considered a template image. |
Parameters |
|
Returns |
|
Notes |
|
Source | extensions/image/libimage.m line 1587 |
toASCII
Signature | hs.image:toASCII([width, height]) -> string |
---|---|
Type | Method |
Description | Converts an image to an ASCII representation of the image in the form of a string. |
Parameters |
|
Returns |
|
Source | extensions/image/libimage.m line 1630 |
© 2014–2017 Hammerspoon contributors
Licensed under the MIT License.
https://www.hammerspoon.org/docs/hs.image.html