Color & Effects

Images, masks and blend modes

In Nox a picture is a fill. It is not a special kind of layer: any rectangle, ellipse, path or frame can be filled with one, have it fitted, cropped and color-corrected, and still have corners, strokes, shadows and other fills on top. Masks show a picture or a group only within a shape. Blend modes mix a layer with what is behind it. Together they cover most of what a photo needs in an interface.

The same picture as Fill, Fit, Stretch, Tile and Crop in a tall box
The same picture as Fill, Fit, Stretch, Tile and Crop in a tall box

Image fills#

FitIn the toolsWhat it does
Fill"fit": "fill"Covers the box, cut at the sides that overflow. The default, and right for covers and avatars
Fit"fit": "fit"All of the picture, inside the box, with room left over
Stretch"fit": "stretch"Pulled to the box on both sides; changes the picture's proportions
Tile"fit": "tile"Copies side by side from the corner, each tile_scale times the picture's own size
Crop"fit": "crop"The part "crop": [left, top, width, height] of the picture, in parts of it from 0 to 1, stretched to the box
By hand
  1. File › Place Image… ⇧⌘K places a PNG or JPEG as a new rectangle filled with it. To fill a shape that is already there, click its fill's swatch and choose Image at the top of the picker.
  2. Choose how it fits from the menu on the paint's row: Fill, Fit, Stretch, Tile or Crop.
  3. Choose Crop and the canvas shows the picture's frame with eight handles and a veil over what is cut away. Drag a handle, or drag inside to move the frame over the picture. Press Return or Escape when it is right.
  4. Under the paint's More are the part shown (Left, Top, Width, Height, in percent) and the color changes.

The file is copied into the document, so the .ndf keeps working when the original moves.

Color changes#

Seven numbers, each from −100 to 100, correct a picture without leaving Nox:

In the inspectorIn the toolsWhat it does
ExposureexposureLighter or darker overall
ContrastcontrastFurther apart or closer together, light and dark
SaturationsaturationMore or less color; −100 is black and white
WarmthtemperatureToward orange, or toward blue
TinttintToward magenta, or toward green
HighlightshighlightsThe light parts alone
ShadowsshadowsThe dark parts alone
A picture as it is, and with exposure, contrast, saturation, warmth, highlights and shadows changed
A picture as it is, and with exposure, contrast, saturation, warmth, highlights and shadows changed

Small moves go a long way. To make a set of photos from different sources look like one shoot, give them all the same small warmth and saturation (say 15 and −10). For a photo behind white text, lower its exposure or highlights rather than laying a black rectangle over it.

With an agent
Fill the cover with lake.jpg, a little brighter and warmer, slightly less saturated.

The agent calls update_nodes:

{
  "changes": [{
    "id": "7:2",
    "fill": {"image": "/Users/you/Pictures/lake.jpg", "fit": "fill", "exposure": 10, "contrast": 15, "saturation": -20, "temperature": 20}
  }]
}

image is an absolute path to a PNG or JPEG, a data: URI, or an asset: reference that get_nodes reports for a picture already in the document. To reuse a picture, pass that reference instead of the file again.

Masks#

A mask is a node that is not drawn itself: the siblings above it in the same parent show only within its shape, up to the next mask. Any rectangle, ellipse, path, boolean or text can be one.

A picture masked by an ellipse, by a fading gradient by alpha, and by the letters of a word
A picture masked by an ellipse, by a fading gradient by alpha, and by the letters of a word
By hand
  1. Put the shape that will be the mask under what it should show, in the layer list.
  2. Select both, and choose Arrange › Use as Mask ⌃⌘M. Nox groups them, and the lowest becomes the mask.
  3. With one thing selected, Use as Mask makes it the mask of the siblings above it; choose it again to make it an ordinary layer.

A mask works three ways, set by mask_by:

  • outline, the default: its shape, whatever its fill.
  • alpha: as much as the mask is opaque. A gradient that fades to transparent fades what it masks: a photo that dissolves into the page.
  • luminance: as much as the mask is light. White shows all, black none.
With an agent
Show the profile photo in a 96 circle.

The agent calls create_nodes, with a group holding the mask first and the photo after it:

{
  "nodes": [{
    "kind": "group", "name": "Avatar", "x": 0, "y": 0,
    "children": [
      {"kind": "ellipse", "name": "Mask", "x": 0, "y": 0, "width": 96, "height": 96, "fill": "#000000", "mask": true},
      {"kind": "rectangle", "name": "Photo", "x": -24, "y": 0, "width": 144, "height": 96, "fill": {"image": "/Users/you/Pictures/lake.jpg"}}
    ]
  }]
}

Keep a mask and what it masks in a group or a frame of their own, so the mask reaches nothing else. A sibling above a mask with unmasked: true steps out of it and is drawn whole, such as a badge on the corner of a masked avatar.

For one picture in a simple shape, a mask is not needed: fill the ellipse or the rounded rectangle with the picture itself. Use a mask for a group of several layers, for text as a window, and for fades by alpha.

Blend modes#

A blend mode says how a node, with everything in it, is mixed with what is behind it. Nox has sixteen: normal, darken, multiply, color_burn, lighten, screen, color_dodge, overlay, soft_light, hard_light, difference, exclusion, hue, saturation, color and luminosity.

An orange-to-blue square over a photo in each of the sixteen blend modes
An orange-to-blue square over a photo in each of the sixteen blend modes

By hand, the blend mode is in the menu under More below the size fields, at the top of the inspector. The ones you will use most:

  • multiply darkens: a texture of paper, a shadow drawn by hand, a tint that keeps the photo's detail.
  • screen lightens: light leaks, glows, stars on a dark sky.
  • overlay and soft_light add contrast and color at once: a colored gradient over a photo to give a hero a mood.
  • color takes only the hue and saturation of the layer: a duotone photo in your brand's color.
  • luminosity takes only the lightness: a black-and-white texture laid over color.
With an agent
Lay an orange-to-blue gradient over the hero photo in soft light, to warm the top and cool the bottom.

The agent calls create_nodes, with the hero frame as parent:

{
  "parent": "7:1",
  "nodes": [{
    "kind": "rectangle", "name": "Mood", "x": 0, "y": 0, "width": 360, "height": 240, "corner_radius": 20,
    "fill": {"gradient": "linear", "angle": 180, "stops": ["#FF8A3C", "#2F6BFF"]},
    "blend_mode": "soft_light"
  }]
}
Note

A blend mode belongs to the node, not to each of its fills. To blend a color over a picture, put it on a layer of its own above the picture, as above.