Skip to content

Instantly share code, notes, and snippets.

@matmen
Last active September 12, 2024 20:24
Show Gist options
  • Save matmen/d4fa000110efe2944078fb8065dafd11 to your computer and use it in GitHub Desktop.
Save matmen/d4fa000110efe2944078fb8065dafd11 to your computer and use it in GitHub Desktop.

⚠️ This is not the documentation for ImageScript. You can find the ImageScript documentation here.


Image Tags

The following commands / statements are valid:

load <url> <imageName> - Loads the given URL and saves it as imageName

screenshot <url> <imageName> - Screenshots the given URL and saves it as imageName

resize <imageName> <width> <height> - Resizes the given image to the given width and height

contain <imageName> <width> <height> - Resizes the given image to be contained in the given dimensions, preserving its aspect ratio

cover <imageName> <width> <height> - Resizes the given image to cover the given dimensions, preserving its aspect ratio

fit <imageName> <width> <height> - Resizes the given image to be contained in the given dimensions without changing its bounding box aspect ratio

rotate <imageName> <degrees (0 - 360)> [rescale = true] - Rotates the given images by the given rotation

overlay <imageName> <overlayName> <x> <y> - Overlays the overlay image onto the given image at the given coordinates

explode <imageName> - Explodes the image

implode <imageName> - Implodes the image

magik <imageName> [iterations (1 - 10) = 1] [rescale = false] - Applies magik to the given image with the given iterations/delta

jpeg <imageName> <quality (1 - 100)> - JPEG-ifies the given image with the given quality

brightness <imageName> <brightness (-100 - 100)> - Modifies the given images brightness by the given value

contrast <imageName> <contrast (-100 - 100)> - Modifies the given images contrast by the given value

opacity <imageName> <alpha (0 - 100)> - Modifies the given images opacity by the given value

pixelate <imageName> <pixelSize (2+)> - Pixelates the given image with the given pixel size

greyscale <imageName> - Converts the given image to greyscale

invert <imageName> - Inverts the given image

tti <imageName> <size> <wrap width> <color> <text...> - Converts the given text to an image

ttil <imageName> <size> <wrap width> <color> <text...> - Converts the given text to an image (aligned left)

ttir <imageName> <size> <wrap width> <color> <text...> - Converts the given text to an image (aligned right)

skew <imageName> <angle> [vertical = false] - Skews the given image by the given angle [in the given direction]

get <imageName> <key (width, height)> <variableName> - Gets the width or the height of the given image and saves it into the given variable name (Note that variable names do not support numbers)

copy <imageName> <cloneName> - Clones the given image and saves it as the given clone name

render <imageName> - Renders and returns the given image and ends the script

Comments: You can add a comment by appending ## Comment Here to a line

Example Script: (.t istest)

{iscript:
load {if:{avatar:{arg:0}}|=||then:{arg:0}|else:{avatar:{arg:0}}} image            ## Load the image from the arguments (default to user's avatar)
load http://www.pngall.com/wp-content/uploads/2016/05/Christmas-Hat.png overlay ## Load a christmas hat overlay
magik image 2                                                                   ## Apply magik to the image twice
get image width w                                                               ## Save the images width as w
get image height h                                                              ## Save the images height as h
resize overlay (w/2) (h/2)                                                      ## Calculate the overlay's new size
overlay image overlay (w/2) 0                                                   ## Add the overlay to the image
render image                                                                    ## Render the image
}
@cakedan
Copy link

cakedan commented Sep 12, 2024

There are defaults, MEDIA_NAMEw is width, MEDIA_NAMEh is height, MEDIA_NAMEd is duration.

But the values you can get are width, height, and duration (get MEDIA_NAME duration KEY for the length)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment