Skip to content
Updated info about the image filter chain scripts. authored by Kevin Meaney's avatar Kevin Meaney
......@@ -477,7 +477,7 @@ The shaded material core image filter takes two images. The inputImage is the he
![Image 6. Embossed image with bump distortion](https://gitlab.com/ktam/using-movingimages/raw/master/wiki-images/BumpDistortionEmbossedImage.jpg "An embossed image with a bump distortion filter applied.")
I originally wrote a ruby script before I had created a ruby gem which generated a gif animation by capturing the frames and adding them to an image exporter object. [The embossmask gif creation script](https://gitlab.com/ktam/using-movingimages/blob/master/miscellaneous/scripts/embossmask). Here is the resulting gif animation:
I wrote the emboss ruby script before I had created a ruby gem which generated a gif animation by capturing the frames and adding them to an image exporter object. [The embossmask gif creation script](https://gitlab.com/ktam/using-movingimages/blob/master/miscellaneous/scripts/embossmask). Here is the resulting gif animation:
![Bump distortion gif animation](https://gitlab.com/ktam/using-movingimages/raw/master/wiki-images/EmbossedBumpDistortionAnimation.gif "An embossed bump distortion image animation.")
......@@ -787,30 +787,9 @@ Creating an image filter chain object with the property list dictionary defined
### The Image Filter Chain Ruby Processing Scripts
The examples for using the image filter chain scripts assumes that the scripts are in a folder that is in your PATH. These scripts were written prior to writing the ruby gem and are all self contained. They should be rewritten using the moving_images ruby gem.
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).
There are four scripts that come with Moving Images for applying core image filters to images. They are the [coreimageblend](https://gitlab.com/ktam/using-movingimages/blob/master/miscellaneous/scripts/coreimageblend), [simplesinglecifilter](https://gitlab.com/ktam/using-movingimages/blob/master/miscellaneous/scripts/simplesinglecifilter), [dotransition](https://gitlab.com/ktam/using-movingimages/blob/master/miscellaneous/scripts/dotransition) and [embossmask](https://gitlab.com/ktam/using-movingimages/blob/master/miscellaneous/scripts/embossmask). All these scripts take the command line switch --help which returns information about how to use the script.
coreimageblend --help
There is also the --verbose option, which is helpful when debugging writing scripts but can also be useful when you want to grab the generated json objects which is how I used the embossmask script when I needed json objects for this documentation.
The coreimageblend script takes two input images, combines them together using the selected Core Image blend filter and produces an output image:
To get a list of the core image blend filters:
coreimageblend --listfilters
Which returns:
CIAdditionCompositing CIColorBlendMode CIColorBurnBlendMode CIColorDodgeBlendMode CIDarkenBlendMode CIDifferenceBlendMode
CIExclusionBlendMode CIHardLightBlendMode CIHueBlendMode CILightenBlendMode CILuminosityBlendMode CIMaximumCompositing CIMinimumCompositing
CIMultiplyBlendMode CIMultiplyCompositing CIOverlayBlendMode CISaturationBlendMode CIScreenBlendMode CISoftLightBlendMode
CISourceAtopCompositing CISourceInCompositing CISourceOutCompositing CISourceOverCompositing
To combine two images using a core image blend filter:
coreimageblend --filter CISourceOverCompositing --foregroundimage "~/images/horizontaltestpattern.png" --backgroundimage "~/images/verticaltestpattern.png" --outputfile "~/Desktop/SourceOverTestPattern.png"
All scripts take the command line option --help which provides a brief description of the script, what command line options the script takes and a couple of examples.
The simplesinglecifilter script allows you to apply a single core image filter to an image and save the result as a new image file. The simplesinglecifilter script only allows you to apply a filter which has relatively simple inputs. This means a filter that takes a single input image, and 2 or fewer numerical inputs. Filters that are not available are ones that takes inputs that are vectors or colors, or ones that take an image which is assigned as an input using a key other than "inputImage".
......@@ -855,11 +834,10 @@ The "cifilterproperties" key has an array of filter properties as its value. The
To apply the unsharp mask filter to an image:
simplesinglecifilter --filter CIUnsharpMask --inputvalue1=4 --inputvalue2=1.3 --inputimage "~/Desktop/fuzzyimage.jpg" --outputfiletype public.jpeg --outputfile "~/Desktop/Unsharpedfuzzyimage.jpg"
simplesinglecifilter --filter CIUnsharpMask --inputkey1 inputRadius --inputvalue1=4 --inputkey2 inputIntensity --inputvalue2 1.3 --exportfiletype public.jpeg --outputdir "~/Desktop/examples" ~/Desktop/exampleimages/*.JPG
The option "inputvalue1" relates to the "inputRadius" property of the CIUnsharpMask filter while "inputvalue2" relates to the "inputIntensity" of the CIUnsharpMask filter.
The "dotranstion" filter allows you to use any of the Core Image transition filters to transition from one image to another. This script is a bit more involved than the others with more command line options. Reading the output when using the "--help" command line option is sensible. The "dotransition" script will produce multiple images for each transition, you can specify how many images with the "--count" command line option.
The "dotranstion" script allows you to use any of the Core Image transition filters to transition from one image to another. This script is a bit more involved than the others with more command line options. Reading the output when using the "--help" command line option is sensible. The "dotransition" script will produce multiple images for each transition, you can specify how many images with the "--count" command line option.
To get the list of transition filters:
......@@ -870,12 +848,36 @@ Which returns:
CIBarsSwipeTransition CIRippleTransition CISwipeTransition CICopyMachineTransition CIDisintegrateWithMaskTransition CIFlashTransition
CIDissolveTransition CIModTransition CIPageCurlTransition CIPageCurlWithShadowTransition
One example of the use of the dotransition script is, though you'll need to update the file paths to image files on your computer:
An example of the dotransition script is, though you'll need to update the file paths to image files on your computer:
dotransition --count 30 --sourceimage "~/Desktop/exampleimages/DSCN0744.JPG" --destinationimage "~/Desktop/exampleimages/DSCN0746.JPG" --transitionfilter CIFlashTransition --striationstrength 0.8 --color 1.0,0.4,0.1,1.0 --fadethreshold 0.7 --extent 0,0,908,681 --center 454,340 --striationcontrast 1.375 --outputdir "~/Desktop/junkimages/flashtransition" --basename Flash --outputfiletype public.jpeg --verbose
[Examples for using all the core image transition filters](https://gitlab.com/ktam/using-movingimages/blob/master/coreimage/transitioncommands.sh)
The core image blend script:
coreimageblend --help
There is also the --verbose option, which is helpful when debugging writing scripts but can also be useful when you want to grab the generated json objects which is how I used the embossmask script when I needed json objects for this documentation.
The coreimageblend script takes two input images, combines them together using the selected Core Image blend filter and produces an output image:
To get a list of the core image blend filters:
coreimageblend --listfilters
Which returns:
CIAdditionCompositing CIColorBlendMode CIColorBurnBlendMode CIColorDodgeBlendMode CIDarkenBlendMode CIDifferenceBlendMode
CIExclusionBlendMode CIHardLightBlendMode CIHueBlendMode CILightenBlendMode CILuminosityBlendMode CIMaximumCompositing CIMinimumCompositing
CIMultiplyBlendMode CIMultiplyCompositing CIOverlayBlendMode CISaturationBlendMode CIScreenBlendMode CISoftLightBlendMode
CISourceAtopCompositing CISourceInCompositing CISourceOutCompositing CISourceOverCompositing
To combine two images using a core image blend filter:
coreimageblend --filter CISourceOverCompositing --foregroundimage "~/images/horizontaltestpattern.png" --backgroundimage "~/images/verticaltestpattern.png" --outputfile "~/Desktop/SourceOverTestPattern.png"
The "embossimage" script is more a demonstration script than a general purpose script, and is the basis for how I have demonstrated many of the features of the image filter chain object and how to chain filters together as described the documentation. Nevertheless the script has a number of inputs making it possible to view how changing input values affects the produced output.
### The YVSChromaKey Filter
......
......