Modding:Image Processing Directives

From Starbounder - Starbound Wiki
Jump to: navigation, search

Image Directives

Directives are assumed to be applied in direct left-to-right order.

Whenever colors are mentioned, they should be valid six or eight-digit hexadecimal color codes. The last two digits of an eight-digit color code represents the alpha value of the color; an optional value in most directives. Color codes are case-insensitive.

"FFFFFF" (white)

"0000007F" (black, semitransparent)


Base image used in examples:

/interface/cockpit/initiatejumpover.png

SBDirectives-Base.png

setcolor

Adjusts the RGB values of all pixels on the image to the given value, including semitransparent pixels. The alpha value of each pixel remains untouched.

Usage
"<file>?setcolor=<color>"
Example
"/interface/cockpit/initiatejumpover.png?setcolor=8888FF"
SBDirectives-SetColor.png

replace

A directive to apply palette swap on the image. Changes the color of all pixels colored "from" to "to". If no alpha value is given to replace, only opaque pixels are replaced. Likewise, if no alpha value is given as the new color, matching pixels will result fully opaque.

Usage
"<file>?replace;<colorFrom1>=<colorTo1>;<colorFrom2>=<colorTo2>"
Example
"/interface/cockpit/initiatejumpover.png?replace;D9B035=778FD8;B0811D=5C6FA5;FBDF71=8EAAFF"
SBDirectives-Replace.png

hueshift

Adjusts the hue of each color by the given amount of degrees.

Usage
"<file>?hueshift=<degrees>"
Example

0-360 360-720...

"/interface/cockpit/initiatejumpover.png?hueshift=180"
SBDirectives-Hueshift.png

brightness

Increases or decreases the brightness of the image by the given percentage. Values above 100 and below -100 will result in the same as 100 or -100 respectively.

Usage
"<file>?brightness=<difference>"
Example
"/interface/cockpit/initiatejumpover.png?brightness=0"
"/interface/cockpit/initiatejumpover.png?brightness=-50"
"/interface/cockpit/initiatejumpover.png?brightness=-100"
SBDirectives-Brightness.png

saturation

Usage
"<file>?saturation=<difference>"
Example
"/interface/cockpit/initiatejumpover.png?saturation=50"
SBDirectives-Saturation.png

Note: Same rules as brightness.

border

Draws a border <pixels> wide around the outer contour of the image content (only opaque parts are outlined). Note that the border has the same scale as the image itself.

Usage
"<file>?border=<pixels>;<innerColor>;<outerColor>"
Example
"/interface/cockpit/initiatejumpover.png?border=10;FF0000;0000FF"
SBDirectives-Border.png

crop

Usage
"<file>?crop=x1;y1;x2;y2"
Example
"/interface/cockpit/initiatejumpover.png?crop=14;2;43;32"
SBDirectives-Crop.png

Note: The bottom left corner of the picture is the origin. Although the rest of the image is gone, the position of this frame is still the same as without cropping, meaning you may have to compensate by adjusting the image position.

Also note: Both points are drawn from the bottom-left of the image itself. The second set of numbers does not automatically include the first.

flipx / flipy / flipxy

Mirrors the image on the specified axis

Usage
"<file>?flipx"
"<file>?flipy"
"<file>?flipxy"
Example
"/interface/cockpit/initiatejumpover.png?flipx?flipy"
SBDirectives-FlipXFlipY.png

multiply

Usage
"<file>?multiply=<color>"
Example
"/interface/cockpit/initiatejumpover.png"
"/interface/cockpit/initiatejumpover.png?multiply=FFFFFF00"
"/interface/cockpit/initiatejumpover.png?multiply=FFFFFF80"
SBDirectives-Multiply.png

fade

Reduces the transparancy of the image.

Usage
"<file>?fade=<color>=<amount>"
Example
"/interface/cockpit/initiatejumpover.png?fade=0"
"/interface/cockpit/initiatejumpover.png?fade=0.5"
"/interface/cockpit/initiatejumpover.png?fade=1"
SBDirectives-Fade.png

scale / scalenearest / scalebicubic / scalebilinear

Usage
"<file>?<scaleMethod>=<factor>"
"<file>?<scaleMethod>=<factor_x>;<factor_y>"
Example
"/interface/cockpit/initiatejumpover.png?scalenearest=0.5"
"/interface/cockpit/initiatejumpover.png?scalebicubic=0.5;1.5"
SBDirectives-ScaleBicubic.png

Note: Scales around the center of the image (meaning the center of the scaled image is at the same position as the center of the original image). This means you may have to compensate by adjusting the position of the image.

addmask

Usage
"<file>?addmask=<path>"
Unconfirmed: "<file>?addmask=<path>;<startX>;<startY>"
Example
"/interface/crafting/bgselection1.png?addmask=/interface/crafting/bgselection6.png"
bgselection1.png:
SBDirectives-AddMask2a.png
bgselection6.png:
SBDirectives-AddMask2b.png
Result:
SBDirectives-AddMask2r.png

submask

Usage
?
Example
?


Note: The transparent pixels on the mask will be removed on the original image. The result only shows pixels (in their original form) that are found on both the original image as the applied mask.

blendmult/blendscreen

Blends two images with multiplication (or screen)

Usage
"<file>?blendmult=<file2>;x;y"
Example
?blendmult=/objects/outpost/customsign/signplaceholder.png;0;0(start with bottom left)
?blendmult=/objects/outpost/customsign/signplaceholder.png;0;-8

Outline

Covers an image with color C and adds an A-pixel thick border of color B.

Usage
""<file>?outline=<number>;<border color>;<image color>""
Example
/items/currency/money.png?outline=1;6666FFCC;00000000

Scanlines

Adds stripes over an image with two colors. Similar to inspection mode.

Usage
""<file>?scanlines=<color1>;<transparency1>;<color2>;<transparency2>""
Example
/items/currency/money.png?scanlines=5555AACC;0.4;5555FFCC;0.4


Image Offset

Usage
"offset" : [ x, y]
Example
"animationCustom" : { "animatedParts" : { "parts" : { "stone" : { "properties" : { "offset" : [ 0.0, 0.5 ] } } } } }
Notes
  • Offset defaults to [ 0, 0 ] unless overridden.
  • The position of any images over other images will be lined up if all the used images are the same size. If the images are not all the same size, the images will need to be manually lined up using offset.
  • If an image has even 1 extra top line of pixels (even if they otherwise look identical), they will not automatically line up and will need to be adjusted.
  • A 1 pixel adjustment is equal to 0.125. (1 [Pixel] / 8 [Default tile size])


Quick Navigation