Skip to content

Documentation

Gökdeniz edited this page Aug 23, 2019 · 92 revisions

Notes

  • Pixel coordinates start from 1.
  • You will see these in the syntaxes:
    width %number%[( and|,)] [with] height %number%
    
    horizontal radius %-number%[( and|,)] [with] vertical radius %-number%
    The width/height and horizontal/vertical order doesn't matter.
  • You can enter a color or a gradient to the %paint% expressions.

How Rotation Works

You will see rotation in the syntaxes, check this page to see how it works: https://github.com/Blueyescat/imagesk/wiki/Using-Rotation

Effects

Create Image

create [a[n]] [new] image with width %number%[( and|,)] [with] height %number%[[( and|,)] [with] b[ack]g[round] [(paint|gradient)] %paint%] [[and] (store|save) [[the] result] (in|to) [variable] %variable%]

Creates an image with specified width, height and background paint and stores the image in the given variable. If you don't enter the background color it will create an empty transparent image.


Get Image

get [the] (image|img) (of|from) (url %text%|file %text%|base[ ]64 %text%) [[and] (store|save) ([[the] result]|it) (in|to) [variable] %variable%]

Gets image from an URL, file or base64 code and stores the image in the given variable.


Save Image

(save|write) [(image|img)] %image% to [file] %text%

Saves an image to a file.


Create Image Text

(create|generate) [a[n]] [new] [(image|img)] (text|string) [(with (id|name)|named)] %text% [[and] [with] (content|text|string) %text%]

Creates a text to write on an image with the specified ID and optional text.
To create a new line you can use "\n", or %nl% expression from an addon.
You can set properties (like font, underline, background color) of this text using the Image Text Property expressions.

Write Text

write [[(image|img)] (text|string) [(with (id|name)|named)]] %text% (on|to) [(image|img)] %image% [at [location] %number%,[ ]%number%] [with rotation %number% degree[s] [angle] [using origin location %number%,[ ]%number%]] [[and] (store|save) ([[the] result]|it) (in|to) [variable] %variable%]

Writes a pre-created text on an image. You can specify the upper left corner location of the text to write.
If you specify a variable, it will store the result in that variable. If you don't, it will edit the image in the first expression.


Resize/Scale Image

resize [(image|img)] %image% to [sizes] width %number%[( and|,)] height %number% [(with|using) algorithm %number%] [[and] (store|save) [[the] result] (in|to) [variable] %variable%]

scale [(image|img)] %image% by width %number% [percent][( and|,)] height %-number% [percent] [(with|using) algorithm %number%] [[and] (store|save) ([[the] result]|it) (in|to) [variable] %variable%]

scale [(image|img)] %image% by %number% [percent] [(with|using) algorithm %number%] [[and] (store|save) ([[the] result]|it) (in|to) [variable] %variable%]

Resizes an image to specified width and height using the specified algorithm. The scale syntaxes are just to make the resizing easier, using percentages. Scaling by 20% makes it 80% smaller, Scaling by 130% makes it 30% bigger.
If you specify a variable, it will store the result in the variable. If you don't, you must enter a variable to the first expression then it will set that variable.

Algorithms:
1: Use the Area Averaging image scaling algorithm.
2: Use the default image-scaling algorithm.
3: Choose an image-scaling algorithm that gives higher priority to scaling speed than smoothness of the scaled image.
4: Use the image scaling algorithm embodied in the ReplicateScaleFilter class.
5: Choose an image-scaling algorithm that gives higher priority to image smoothness than scaling speed.

If you don't enter the algorithm or enter it wrong it will use the default one.


Get Image Part

(get|extract) part of [(image|img)] %image% (from [location] %number%,[ ]%number% to [location] %number%,[ ]%number%|between locations %number%,[ ]%number% and %number%,[ ]%number%) [and] (store|save) [[the] result] (in|to) [variable] %variable%

Returns a part of the image between specified locations.


Draw Image

(draw|merge|paste) [(image|img)] %image% (on|with) [image] %image% [at [location] %number%,[ ]%number%] [with rotation %number% degree[s] [angle] [using origin location %number%,[ ]%number%]] [[and] (store|save) [[the] result] (in|to) [variable] %variable%]

Pastes the first image on the second image. You can specify the upper left corner location of the image to paste.
If you specify a variable, it will store the result in that variable. If you don't, it will edit the image in the first expression.


Draw Line

draw [a] line [(with ((flat|square) (cap|edge[s])))] [with width %number%][[( and|,)] [with] [(paint|gradient)] %paint%][[( and|,)] with rotation %number% degree[s] [angle] [using origin location %number%,[ ]%number%]] on [(image|img)] %image% (from [location] %number%,[ ]%number% to %number%,[ ]%number%|between locations %number%,[ ]%number% and %number%,[ ]%number%) [[and] (store|save) ([[the] result]|it) (in|to) [variable] %variable%]

Draws a line with specified color and width on an image. By default, the line edges will be curved. If you want to make it square, enter the [(with (flat cap|square edge[s]))] part too.
If you specify a variable, it will store the result in that variable. If you don't, it will edit the image in the first expression.


Draw Rectangle

draw [a] rectangle [(outline [with width %number%])] with width %number%[( and|,)] [with] height %number%[[( and|,)] [with] [(paint|gradient)] %paint%][[( and|,)] with rotation %number% degree[s] [angle] [using origin location %number%,[ ]%number%]] on [(image|img)] %image% [at [location] %number%,[ ]%number%] [[and] (store|save) ([[the] result]|it) (in|to) [variable] %variable%]

Draws a rectangle or only a rectangle outline with specified width, height and color on an image. The location means left top location of the rectangle.
If you specify a variable, it will store the result in that variable. If you don't, it will edit the image in the first expression.
If you want to draw a rectangle with rounded corners, you can use the Draw Rounded Rectangle effect.


Draw Rounded Rectangle

draw [a] rounded rectangle [(outline [with width %number%])] with arc width %number%[( and|,)] [with] height %number% with [rectangle] width %number%[( and|,)] [with] height %number%[[( and|,)] [with] [(paint|gradient)] %paint%][[( and|,)] with rotation %number% degree[s] [angle] [using origin location %number%,[ ]%number%]] on [(image|img)] %image% [at [location] %number%,[ ]%number%] [[and] (store|save) ([[the] result]|it) (in|to) [variable] %variable%]

Draws a rectangle or only a rectangle outline, but with rounded corners, with specified arc width, arc height, width, height and color on an image. The location means left top location of the rectangle.
If you specify a variable, it will store the result in that variable. If you don't, it will edit the image in the first expression.
If you want to draw a rectangle with rounded corners, you can use the Draw Rounded Rectangle effect.

Examples

create an image with width 256 and height 256 with background color black
draw a rounded rectangle outline with width 8 with arc width 50 and height 100 with rectangle width 128 and height 128 with color white on the image at 64, 64
draw a rectangle with width 192 and height 64 with color red with opacity 80 on the image at 32, 96
save the image to "output.png"

Output: https://i.ibb.co/S36DmjD/image.png


Draw Oval

draw [a[n]] (oval|ellipse) [(outline [with width %number%])] with horizontal radius %number%[( and|,)] [with] vertical radius %number%[[( and|,)] [with] [(paint|gradient)] %paint%][[( and|,)] with rotation %number% degree[s] [angle] [using origin location %number%,[ ]%number%]] on [(image|img)] %image% [at [[center] location] %number%,[ ]%number%] [[and] (store|save) ([[the] result]|it) (in|to) [variable] %variable%]

Draws an oval or only an oval outline with specified vertical radius, horizontal radius and color on an image. The location means center location of the oval.
For example if you make the vertical radius 200 then the width of the oval will ve 400.
If you specify a variable, it will store the result in that variable. If you don't, it will edit the image in the first expression.
If you want to draw a circle, you can use the Draw Circle effect or make the width and height the same.


Draw Circle

draw [a[n]] circle [(outline [with width %number%])] with (radius|size) %number%[[( and|,)] [with] [(paint|gradient)] %paint%][[( and|,)] with rotation %number% degree[s] [angle] using origin location %number%,[ ]%number%] on [(image|img)] %image% [at [[center] location] %number%,[ ]%number%] [[and] (store|save) ([[the] result]|it) (in|to) [variable] %variable%]

Draws an circle or only a circle outline with specified radius and color on an image. The location means center location of the circle.
If you specify a variable, it will store the result in that variable. If you don't, it will edit the image in the first expression.
If you want to draw a circle, you can just make the width and height the same.


Draw Polygon

draw [a] polygon [outline [with ((flat|square) (cap|(edge|corner)[s]))] [with width %number%]][[( and|,)] [with] [(paint|gradient)] %paint%][[( and|,)] with rotation %number% degree[s] [angle] [using origin location %number%,[ ]%number%]] on [(image|img)] %image% ((between|at)|using) [(corner|vertice|vertex|point)] locations %numbers% [[and] (store|save) ([[the] result]|it) (in|to) [variable] %variable%]

draw [a] polygon [outline [with (flat|square) (cap|(edge|corner)[s])] [with width %number%]][[( and|,)] [with] [(paint|gradient)] %paint%] (with|using) (corners|vertices|vertexes|points) %number% with radius %number%[[( and|,)] [with] angle %number% degree[s]][[( and|,)] with rotation %number% degree[s] [angle] [using origin location %number%,[ ]%number%]] on [(image|img)] %image% [at [[center] location] %number%,[ ]%number%] [[and] (store|save) ([[the] result]|it) (in|to) [variable] %variable%]

First Syntax:

Draws an polygon or just its outline using specified corner locations and color on an image.
Note: Input corner locations will be seperated two by two, for example if you enter *5, 10, 15, 20, 25, 30 this will make the polygon corners 5, 10, 15, 20 and 25, 30. Yeah, the syntax might look confusing. You can use brackets to make the syntax look better. Example: (5 and 10), (15 and 20) and (25 and 30)
If you specify a variable, it will store the result in that variable. If you don't, it will edit the image in the first expression.

Example

draw a polygon outline with width 12 with color blue on the last created image using corner locations (10, 10), (512, 256), (30, 65) and (30, 400)

Second Syntax:

Draws an polygon or just its outline using specified vertice count, radius, angle, color and center location on an image.
The angle is 180 by default. Thanks to @bi0qaw for the algorithm of this auto polygon generator.
If you specify a variable, it will store the result in that variable. If you don't, it will edit the image in the first expression.

Example

draw a polygon outline with width 12 and with color blue with vertices 6 with radius 80 on the last image at center location 196, 80

Bucket Fill

[(flood|bucket)] fill [on] [(image|img)] %image% at [location] %number%,[ ]%number% (with|using) [replace[ment]] %color% [with tolerance %number% [percent]] [[and] (store|save) ([[the] result]|it) (in|to) [variable] %variable%]

You should know what is bucket filling already. Take this as an example. This effect can be very slow, depends on the image.
If you specify a variable, it will store the result in that variable. If you don't, it will edit the image in the first expression.


Make Image Rounded

make [(image|img)] %image% rounded with arc[h] width %number%[( and|,)] [with] height %number% [[and] (store|save) ([[the] result]|it) (in|to) [variable] %variable%]
round [(image|img)] %image% with arc[h] width %number%[( and|,)] [with] height %number% [[and] (store|save) ([[the] result]|it) (in|to) [variable] %variable%]

make [(image|img)] %image% (circle|[fully] rounded) [[and] (store|save) ([[the] result]|it) (in|to) [variable] %variable%]
[fully] round [(image|img)] %image% [[and] (store|save) ([[the] result]|it) (in|to) [variable] %variable%]

Makes the image rounded. If you want to make the image a circle, the image must be square (See: Resize/Scale Image effect) and the arc sizes must be the same with the image sizes. Or you can just use the last two patterns!
If you specify a variable, it will store the result in that variable. If you don't, it will edit the image in the first expression.


Make Mask

make mask on [(image|img)] %image% using [(image|img)] %image% [[and] (store|save) ([[the] result]|it) (in|to) [variable] %variable%]
mask [(image|img)] %image% by [(image|img)] %image% [[and] (store|save) ([[the] result]|it) (in|to) [variable] %variable%]
make [(image|img)] %image% masked by [(image|img)] %image% [[and] (store|save) ([[the] result]|it) (in|to) [variable] %variable%]

Makes mask on an image using another image as the mask. Both images must be in the same size (See: Resize/Scale Image effect) or the effect won't do anything.
If you specify a variable, it will store the result in that variable. If you don't, it will edit the image in the first expression.

How it works:

Preview


Register Font

(register|install|load) [(the|new)] font[s] [famil(y|ies)] [(from|of|at|in)] [[the] (file|folder|directory)] %text%

Registers a new font(s) from the specified file or folder.
Note: The registered fonts will be unregistered when the server stops. You can put this effect to on load event in your script.


Upload Image to Discord (Vixio)

upload (image|img) %image% [with ([(format|file)] type|[file] format) %text%] [with (message|embed) %message/text%] to %user/channel% [with %bot/text%] [and store (it|the message) in %variable%]

upload [the] [last[ly]] [(created|generated|received|taken)] (image|img) [with ([(format|file)] type|[file] format) %text%] [with (message|embed) %message/text%] to %user/channel% [with %bot/text%] [and store (it|the message) in %variable%]

Requires Vixio

Uploads an image to a Discord channel/user. All expressions except %image% and %variable% are related to Vixio. Better than saving the image to a file and uploading it.
If you specify a variable, it will store the sent message in that variable.


Create Discord Emote (Vixio)

create [a[n]] [new] (emote|emoji) (using|from|with) [(image|img)] %image% [with ([(format|file)] type|[file] format) %text%] (named|with [the] name) %text% [in %guild%] [with %bot/string%]

Requires Vixio

Creates an emote in a Discord server using an image. All expressions except %image% are related to Vixio.



Expressions

Last Image

[the] [last[ly]] [(created|generated|received|taken)] (image|img)

Gets the latest created/received image from Create Image or Get Image effects. Can be used for the %image% expression in all (or many) syntaxes like Resize/Scale Image, Write Text, Pixel Color and Image Width/Height...

Can be deleted.

Expressions

Image Copy

(copied|cloned) [image[s]] %images%
[a] (cop(y|ies)|clone[s]) of [image[s]] %images%
%images%'[s] (cop(y|ies)|clone[s])

Copies the given images.

Example Usage

on load:
	set {images::template} to the image from file "images/template.png"

# ... :
	set {_template} to a copy of {images::template}
	# Editing {_template} won't affect the stored template.

Base64 Encoded Image

base[ ]64 encoded [(image|img)] %image% [with ([(format|file)] type|[file] format) %text%]

Converts an image to base64 string.


Color

[(image|img)] colo[u]r [from] %skript color%[[,] [with] (opacity|transparency) %number% [percent]]

[(image|img)] colo[u]r [from] rgb[ ][(]%number%, %number%, %number%[)][[,] [with] (opacity|transparency) %number% [percent]]

[(image|img)] colo[u]r [from] hex %text%[[,] [with] (opacity|transparency) %number% [percent]]

%skript color% with (opacity|transparency) %number% [percent]

colo[u]rs %objects%

Gets image color from input Skript color, RGB or HEX code with optional opacity.

The last syntax is a helper expression, which allows you to use something like colors red and "00FF00" instead of color red and color "00FF00".


Linear Gradient

[a] [new] [((repeating|repeated)|(reflected|reflecting))] linear gradient with %colors%[[(,| and)] [with] (fraction|distribution)s %numbers%] (from [location] %number%,[ ]%number% to %number%,[ ]%number%|between locations %number%,[ ]%number% and %number%,[ ]%number%)

Creates a new linear gradient with the specified cycle method, colors, fractions and start/end locations. Can be used for the %paint% expressions. The location means a location in the image, not a location in the used shape (like when drawing a rectangle).

Click here for examples


Radial Gradient

[a] [new] [(repeating|reflected)] (radial|circular) gradient with %colors%[(,| and)] [with] radius %number%[[(,| and)] [with] (fraction|distribution)s %numbers%] at [center] [location] %number%,[ ]%number% [using (start|focus) location %number%,[ ]%number%]

[a] [new] [(repeating|reflected)] (radial|circular) gradient with %colors%[(,| and)] [with] horizontal radius %number%[( and|,)] [with] vertical radius %number%[[(,| and)] [with] (fraction|distribution)s %numbers%] at [center] [location] %number%,[ ]%number% [using (start|focus) location %number%,[ ]%number%]

Creates a new radial gradient with the specified cycle method, colors, radius (vertical/horizontal on the second syntax), fractions, center location and focus location. Can be used for the %paint% expressions. The center location means a location in the image, not a location in the used shape (like when drawing a rectangle).

Click here for examples


Image Width/Height

[the] (width|height) of [(image|img)] %image%
[the] [(image|img)] (width|height) of %image%
[(image|img)] %image%'s (width|height)
%image%'s [(image|img)] (width|height)

Returns the width or height of an image. You can't set this, you have to use the Resize/Scale Image effect so you can specify what algorithm will be used to resize.


Pixel Color

[the] [colo[u]r of] pixel [at [location]] %number%,[ ]%number% of %image%
%image%'[s] [colo[u]r of] pixel [at [location]] %number%,[ ]%number%

Returns the color of a specified pixel on a image, can be set or deleted. Deleting makes it transparent pixel.


Image/Color Opacity

[the] (opacity|transparency) of %image/color%
%image/color%'[s] (opacity|transparency)

Opacity of an image doesn't return anything, but can be set.
Opacity of a color returns percentage (as a number) also can be set.


Image Text Property

(text|string) of [[(image|img)] (text|string)] %text%

The text of the image text. Can be set or reset. Returns text.
To create a new line on the text you can use "\n", or %nl% expression from an addon.

font[[( |-)]family] of [[(image|img)] (text|string)] %text%

The font of the image text. Can be set or reset. Returns text.
To get all avaiable font names, use All Fonts expression; to register a new font, use Register Font effect.

(bold|italic|underline[d]|strikethrough|outline[d]|(only|just) outline) [state] of [[(image|img)] (text|string)] %text%

Bold, italic, underline, strikethrought or outline states of the image text. Can be set or reset. Returns boolean.
Turning on the only outline state means the text will not be filled with the foreground color.
Turning on the outline state means the text will have a black outline with width 1 (default)

size of [[(image|img)] (text|string)] %text%

Returns the size of the image text. Can be set, increased, decreased or reset. Returns number.

[foreground] colo[u]r of [[(image|img)] (text|string)] %text%
background colo[u]r of [[(image|img)] (text|string)] %text%
outline colo[u]r of [[(image|img)] (text|string)] %text%

Returns foreground, background or outline color of the image text. Can be set or reset. Returns image color.

outline (width|size) of [[(image|img)] (text|string)] %text%

Returns outline width of the image text, 1 by default and must be higher than 0. Can be set, increased, decreased and reset. Returns number.

Note

Using underline, strikethrough and background color with outline in the same time isn't supported currently. These properties just won't work if you try to use.


Image Text Sizes

[the] (width|height|ascent|descent) of [(image|img) (text|string)] %text%
[the] [(image|img) (text|string)] (width|height|ascent|descent) of %text%
[(image|img) (text|string)] %text%'s (width|height|ascent|descent)
%text%'s [(image|img) (text|string)] (width|height|ascent|descent)

Returns width, height, ascent or descent sizes of the image text. Depends on the font, bold state and italic state. Can't be changed. Returns number.


Image Text With ID

[the] [(image|img)] (text|string) [((with|from) (id|name)|named)] %text%

Can be deleted.


All Image Texts

[(all [[of] the]|the)] (image|img) (text|string)s

Can be cleared.


All Fonts

[(all [[of] the]|the)] [available] fonts
[(all [[of] the]|the)] [available] font (families|[family] names)

Returns a list of all currently available fonts. Can't be edited. If you want to register a new font, use Register Font effect.

Conditions

Are Similar Colors

%color% is similar to %color% [with (tolerance %number% [percent]|%number% [percent] tolerance)]
%color% (isn't|is not) similar to %color% [with (tolerance %number% [percent]|%number% [percent] tolerance)]

Checks for if input colors are similar with optional tolerance.

Examples

if color red is similar to color red: #True

if color "FF0002" is similar to color "FF0005" with tolerance 2: #True

if color "FF0002" is similar to color "FF0008" with tolerance 2: #False