GdiBitmap(arg)

new GdiBitmap(arg)

Parameters:
Name Type Description
arg GdiBitmap

Members

readonly Height :number

readonly Width :number

Methods

ApplyAlpha(alpha) → {GdiBitmap}

Parameters:
Name Type Description
alpha number Valid values 0-255.
Returns:
GdiBitmap

ApplyMask(img)

Changes will be saved in the current bitmap.
Parameters:
Name Type Description
img GdiBitmap
Example
<caption>Blur image<caption>
// See `samples/basic/Apply Mask.js`

Clone(x, y, w, h) → {GdiBitmap}

Parameters:
Name Type Description
x number
y number
w number
h number
Returns:
GdiBitmap

CreateRawBitmap() → {GdiRawBitmap}

Create a DDB bitmap from GdiBitmap, which is used in GdiGraphics#GdiDrawBitmap
Returns:
GdiRawBitmap

GetColourScheme(max_count) → {Array.<number>}

Parameters:
Name Type Description
max_count number
Returns:
Array.<number>

GetColourSchemeJSON(max_count) → {string}

Returns a JSON array in string form so you need to use JSON.parse() on the result.
Each entry in the array is an object which contains colour and frequency values.
Uses a different method for calculating colours than GdiBitmap#GetColourScheme.
Image is automatically resized during processing for performance reasons so there's no need to resize before calling the method.
Parameters:
Name Type Description
max_count number
Returns:
string
Example
// See docs\Helpers.js for "toRGB" function.
img = ... // use utils.GetAlbumArtV2 / gdi.Image / etc
colours = JSON.parse(img.GetColourSchemeJSON(5));
console.log(colours[0].col); // -4194304
console.log(colours[0].freq); // 0.34
console.log(toRGB(colours[0].col)); // [192, 0, 0]

GetGraphics() → {GdiGraphics}

Note: don't forget to use GdiBitmap#ReleaseGraphics after work on GdiGraphics is done!
Returns:
GdiGraphics

InvertColours() → {GdiBitmap}

Inverts the colours in a bitmap, to create a negative image. i.e. White becomes black, black becomes white, etc.
Returns:
GdiBitmap

ReleaseGraphics(gr)

Parameters:
Name Type Description
gr GdiGraphics

Resize(w, h, modeopt) → {GdiBitmap}

Parameters:
Name Type Attributes Default Description
w number
h number
mode number <optional>
0 See Flags.js > InterpolationMode
Returns:
GdiBitmap

RotateFlip(mode)

Changes will be saved in the current bitmap.
Parameters:
Name Type Description
mode number See Flags.js > RotateFlipType

SaveAs(path, formatopt) → {boolean}

Parameters:
Name Type Attributes Default Description
path string Full path including file extension. The parent folder must already exist.
format string <optional>
'image/png' "image/png"
"image/bmp"
"image/jpeg"
"image/gif"
"image/tiff"
Returns:
boolean
Example
let img = utils.GetAlbumArtEmbedded(fb.GetFocusItem().RawPath, 0);
if (img) {
    img.SaveAs("D:\\export.jpg", "image/jpeg");
}

StackBlur(radius)

Changes will be saved in the current bitmap.
Parameters:
Name Type Description
radius number Valid values 2-254.
Examples
<caption>Blur image<caption>
// `samples/basic/StackBlur (image).js`
<caption>Blur text<caption>
// `samples/basic/StackBlur (text).js`