Raster Image Filters

All editing/modifications on raster frames in Q2Pix are done through filters.

Conceptually, filters can be considered as self-contained programs that take as input a raster image frame along with a set of parameters, and produce as output a new raster frame. Filters may modify the frame’s metadata and pixels.

They fall into two basic categories:

  • Metadata filters modify the metadata, e.g. Resolution and XMP.
  • Pixel filters modify the pixels:
    • Geometry filters change the pixel map’s geometry, e.g. Crop and Flip.
    • Effect filters apply an effect on the input pixels, e.g. Brightness and GaussianBlur.

Editing a raster frame in Q2Pix is done by pushing filters into the frame’s edit stack. The final frame is obtained after applying all filters in the edit stack, in sequence: the first filter takes as input the original frame and outputs a new one which in turn is fed as input to the next filter in the stack, and so on until the filter at the top of the stack produces the current frame. These edits are non-destructive, and can be un-done, in reverse sequence, each time popping the top filter out of the edit stack.

Note

Q2Pix does not itself implement pixel filters, but rather uses platform-specific facilities provided by the system frameworks: CoreImage filters on macOS, and Direct2D effects on Windows.

In both cases, the application of multiple filters is optimized by the OS: CI filters and D2D effects do not directly produce pixel maps, but rather act as recipes for producing the output image. The recipes of all individual pixel filters in the edit stack are combined into a compound recipe that produces the final pixel map when the frame is either displayed or exported/saved to a file.

Filters are identified by their name and each accepts a specific set of parameters in the form of a 4D/JSON object. Pushing a filter to a raster frame is done by passing the filter name and associated parameters to RasterFrame_PushFilter. To un-do the last filter applied to the frame, call RasterFrame_PopFilter.

The Q2PixLib component includes high-level methods that hide the details:

Additionally, there are methods that present 4D dialogs where the user can select an effect and associated parameters:

The raster filters supported by Q2Pix and their respective parameters are listed in the Raster Filter Reference section of the manual.