image

Last updated last month

A module for capturing and manipulating image objects from other modules for use with hs.drawing.

API Overview

API Documentation

Constants

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 hs.drawing.image and hs.image.imageFromName.

Notes

Signature

hs.image.systemImageNames[]

Type

Constant

Description

Table containing the names of internal system images for use with hs.drawing.image

Notes

Constructors

Signature

hs.image.iconForFile(file) -> object

Type

Constructor

Description

Creates an hs.image object for the file or files specified

Parameters

Returns

Signature

hs.image.iconForFileType(fileType) -> object

Type

Constructor

Description

Creates an hs.image object of the icon for the specified file type.

Parameters

Returns

Signature

hs.image.imageFromAppBundle(bundleID) -> object

Type

Constructor

Description

Creates an hs.image object using the icon from an App

Parameters

Returns

Signature

hs.image.imageFromASCII(ascii[, context]) -> object

Type

Constructor

Description

Creates an image from an ASCII representation with the specified context.

Parameters

Returns

Notes

Signature

hs.image.imageFromMediaFile(file) -> object

Type

Constructor

Description

Creates an hs.image object from a video file or the album artwork of an audio file or directory

Parameters

Returns

Notes

Signature

hs.image.imageFromName(string) -> object

Type

Constructor

Description

Returns the hs.image object for the specified name, if it exists.

Parameters

Returns

Notes

Signature

hs.image.imageFromPath(path) -> object

Type

Constructor

Description

Loads an image file

Parameters

Returns

Signature

hs.image.imageFromURL(url) -> object

Type

Constructor

Description

Creates an hs.image object from the contents of the specified URL.

Parameters

Returns

Methods

colorAt

Signature

hs.image:colorAt(point) -> table

Type

Method

Description

Reads the color of the pixel at the specified location.

Parameters

Returns

copy

Signature

hs.image:copy() -> imageObject

Type

Method

Description

Returns a copy of the image

Parameters

Returns

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

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

name

Signature

`hs.image:name([name]) -> imageObject

string` </span>

Type

Method

Description

Get or set the name of the image represented by the hs.image object.

Parameters

Returns

Notes

Signature

hs.image:saveToFile(filename, [scale], [filetype]) -> boolean

Type

Method

Description

Save the hs.image object as an image of type filetype to the specified filename.

Parameters

Returns

Notes

setName

Signature

hs.image:setName(Name) -> boolean

Type

Method

Description

Assigns the name assigned to the hs.image object.

Parameters

Returns

Notes

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

size

Signature

`hs.image:size([size, [absolute]] ) -> imageObject

size` </span>

Type

Method

Description

Get or set the size of the image represented byt he hs.image object.

Parameters

Returns

Notes

template

Signature

`hs.image:template([state]) -> imageObject

boolean` </span>

Type

Method

Description

Get or set whether the image is considered a template image.

Parameters

Returns

Notes