Image
Native image.
Module | require("gui") |
Type | Class |
High DPI Image
By appending @{scaleFactor}x
to the image's base filename, you can mark
the image as a high DPI image. For example an image file with filename of
icon@2x.png
will have scale factor of 2.
Template Image
On macOS you can mark an image as template image by putting Template
to
its base filename, for example iconTemplate.png
and iconTemplate@2x.png
.
Template images should consist of only black and clear colors, and macOS will mix with other content to create best appearance. This is useful for tray icons and menu item icons that automatically adjust to light and dark themes.
Class methods
createEmpty()
Create an empty image.
Return
Image
createFromPath(path)
Create an image by reading from path
.
Parameters
String
path
Return
Image
createFromBuffer(buffer, scaleFactor)
Create an image from buffer
in memory, with scale_factor
.
Parameters
Buffer
bufferNumber
scaleFactor
Return
Image
Methods
getSize()
Return image's size in DIP.
Return
SizeF
getScaleFactor()
Return image's scale factor.
Return
Number