Skip to content
Updated Image filter chain documentation to remove references to command line... authored by Kevin Meaney's avatar Kevin Meaney
Updated Image filter chain documentation to remove references to command line version. Updated TOC to match new order of documentation.
......@@ -42,6 +42,39 @@ To view the CIDroste filter attributes using ruby:
The above obtains the compact JSON object describing the CIDroste core image filter, parses the JSON and then outputs a more human readable form.
### Creating a simple filter chain
The following example demonstrates how a simple image filter chain object is created. The filter chain consists of a single filter, the CIColorControls filter. The filter chain requires the render destination to be specified. The CIColorControls filter requires a single input image, and the numeric inputs do not need to be specified. They can be specified at the time when the filter chain is rendered.
```json
{
"objecttype" : "imagefilterchain",
"objectname" : "e446169b-a960-404f-b0e7-f1962cabdfb7",
"command" : "create",
"imagefilterchaindict" : {
"cifilterlist" : [
{
"cifilterproperties" : [
{
"cifiltervalueclass" : "CIImage",
"cifiltervalue" : {
"imageidentifier" : "demo.zukinidemo.colorcontrols.videoframe"
},
"cifilterkey" : "inputImage"
}
],
"cifiltername" : "CIColorControls",
"mifiltername" : "colorcontrol.filter"
}
],
"cirenderdestination" : {
"objecttype" : "bitmapcontext",
"objectname" : "267ee6ad-76ee-42ad-b86b-2ba33bb21c12"
}
}
}
```
### Setting up the Properties for a Filter
All but a few of the core image filters require inputs. All the numerical inputs for the filters have default values which means for a quick test of a filter you don't need to assign these values. Other input types like the CIImage class, are required as they don't have a default, and input types like CIVector and CIColor have default values, but the default values need to be overridden.
......@@ -648,10 +681,6 @@ render_filterchain_command = CommandModule.make_createimagefilterchain(
Smig.perform_command(render_filterchain_command)
```
The command line equivalent with the JSON already created:
smig doaction -renderfilterchain -object 3 -jsonstring '{"cifilterproperties":[{"cifilterkey":"inputScale","cifiltervalue":-0.0304,"mifiltername":"bumpdistortion"}]}'
All input filter properties can be modified, though the source for the image properties can not be changed. This does not mean that input images do not change between each time the filter chain is rendered. If the input image is the output image of a filter earlier in the filter chain then if that output image changes then the input image will capture that change. If the input image is sourced from a "bitmapcontext" or "nsgraphicscontext" base object then whenever the contents of the base object changes the filter chain object captures that it needs to update the image it uses next time the filter chain is rendered unless the "cisourceimagekeepstatic" attribute has been set to true in the filter property. The "cisourceimagekeepstatic" attribute can be modified at render time:
```json
......@@ -810,24 +839,6 @@ The JSON generated from the above looks like:
}
```
### Creating the Image Filter Chain Object
The above ruby script demonstrates how to build up a filter chain and create an "imagefilterchain" base object. A further example of creating an image filter chain object is in [Creating Objects](CreatingObjects#creating-an-image-filter-chain-object) and another is in the [Image Filter Chain object section of the Playing with objects documentation page](PlayingWithObjects#the-image-filter-chain-object) which shows all the steps for not just creating and rendering the image filter chain object but the creation and actions related to other necessary objects.
The following demonstrates the three ways of creating an image filter chain object at the command line.
Creating an image filter chain object with the json object defined on the command line:
smig create -type "imagefilterchain" -name "com.zukini.documentation.unsharpmaskfilterchain" -jsonstring '{"cifiltername":"CIUnsharpMask","mifiltername":"com.zukini.documentation.renderingfilterchain.unsharpmask","cifilterproperties":[{"cifilterkey":"inputRadius","cifiltervalue":2.5},{"cifilterkey":"inputIntensity","cifiltervalue":1},{"cifilterkey":"inputImage","cifiltervalueclass":"CIImage","cifiltervalue":{"objectreference":0}}]}'
Creating an image filter chain object with the json object defined in a json file:
smig create -type "imagefilterchain" -name "com.zukini.documentation.unsharpmaskfilterchain" -jsonfile "~/JSONFilterFiles/unsharpmask.json"
Creating an image filter chain object with the property list dictionary defined in a property list file:
smig create -type "imagefilterchain" -name "com.zukini.documentation.unsharpmaskfilterchain" -propertyfile "~/PLISTFilterFiles/unsharpmask.plist"
### The Image Filter Chain Ruby Processing Scripts
Two scripts for working with images using core image filters to images come with the installation of the MovingImages ruby gem. They are "simplesinglecifilter" and "dotransition". There are also two other scripts that were written prior to the writing of ruby gem, which have not been updated to use the ruby gem ["coreimageblend"](https://gitlab.com/ktam/using-movingimages/raw/master/miscellaneous/scripts/coreimageblend) and ["embossmask"](https://gitlab.com/ktam/using-movingimages/raw/master/miscellaneous/scripts/embossmask).
......
......