Smile defines some commands to handle image files. For more info on those commands, please consult Smile's dictionary (in the Smile menu).
Image filters
-
The filter image command applies a CoreImage filter to an image file. You can test such filters with the Image filters dialog. Currently, this dialog is accessible from the User scripts > More Smile commands > Misc menu item. This dialog has a "script" button which returns in the Console window the script performing the given filter.
Examples:
|
-- original image
open "http://www.satimage.fr/software/images/smilesaucer.png"
|
|
set f to "http://www.satimage.fr/software/images/smilesaucer.png" --f can be an alias
set fdest to ("" & (path to desktop) & "test.png")
set theDict to "<dict>
<key>inputIntensity</key>
<real>1</real>
</dict>"
filter image f to file fdest selected rectangle {0, 0, 200, 200} filter "CISepiaTone" dictionary theDict
open alias fdest
|
|
set f to "http://www.satimage.fr/software/images/smilesaucer.png" --f can be an alias
set fdest to ("" & (path to desktop) & "test.png")
set theDict to "<dict>
<key>inputCenter</key>
<string>[150 150]</string>
<key>inputRadius</key>
<real>10.0</real>
</dict>"
filter image f to file fdest selected rectangle {0, 0, 200, 200} filter "CICrystallize" dictionary theDict
open alias fdest
|
The User scripts > More Smile commands > Misc > Image filters dialog.
-
The CIfilter names command returns the list of available CoreImage filters to use with the filter image command.
-
The info for CIfilter command provides the full description of the filter or the default settings for the filter image command. This command is opaque: use rather the Image filters from the User scripts > More Smile commands > Misc menu.
Image info and extract image
-
The image info for command returns information about a file image, such as its resolution and its dimensions.
set {f} to navchoose file
image info for f
-- {type identifier:"public.png", resolution:143.992599487305, pixel width:900, width:450, pixel height:830, height:415}
-
The extract image command extracts a subimage from an image file and saves it to disk.
|