update: this is now a standard part of nip2. Click Filter / Magick and have a look.
The development version has an experimental link to ImageMagick in now, built more-or-less in the style of this earlier blog post. There's a Filter / Magick menu with five sample operations, the most complex of which is Annotate, the ImageMagick operation for adding text to an image.
The sourcecode for the Annotate menu item is pretty simple:
Annotate_item = classBut goodness me it turns into a beast when you click it:
Menuaction "_Annotate" "add text annotation" {
action x = class
_result {
_vislevel = 3;
text = text_widget;
font = Font_widget;
geometry = Geometry_widget;
gravity = gravity_widget;
foreground = foreground_widget;
antialias = antialias_widget;
command = magick_command (join_sep " " [
font._flag,
antialias._flag,
gravity._flag,
foreground._flag,
"-annotate", geometry._flag, "\"" ++ text.value ++ "\""]);
_result = system command x;
}
}
It can probably be made a little prettier, but it does need all those options. I suppose sections could be folded away until you needed them.
The menu item supports nip2 Groups, so you can select a set of images and operate on them all at once. There's a toggle in Preferences that lets you switch between ImageMagick and GraphicsMagick (it just prepends "gm" to the command line that gets run). The "command" item shows the command that nip2 is running to generate the image. It knows about adding a ".exe" to the end of the executable name on Windows, though I've not tested that yet.
It seems unlikely that much of the wrapping could be generated automatically: it's just too hard to work out which options modify which operations. Someone would have to go through the docs and make a class for each major command. At least the things are fairly brief.

Hi John.
ReplyDeleteSorry I'm replying 3 years late!
I'm an ImageMagick nerd, though I use it more for artistic than scientific purposes. Via the IM forums, Nicolas Robidoux introduced me to VIPS2. (Forum entry http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=25219 .) I am "snibgo" on the forums.
I have edited my copy of filter.def to incorporate menu items for IM operations: no-op, autogamma, autolevel, border, colorize, blur, colors, despeckle, equalize, gamma, magnify, monochrome, negate, normalize, resize, paint, polaroid, posterize, rotate, radial blur (but I have called it "rotational blur"), sigmoid, solarize, threshold, tint, transpose, transverse, flip, flop, trim, unique-colors.
I have also implemented drop-downs for compose, dither, channels, modulate colorspace, statistic type, virtual pixel; and made minor corrections to Geometry_widget and Alpha.
My edits are not fully tested.
I've only spent a couple of days on this, but I don't want to replicate effort if you know of someone else working on this.
I don't know how far I want to take this. Interfacing to all IM command options would be difficult but more are quite easy and I'd like to do them (subject to other constraints on my time).
I have published my filters.def at https://www.dropbox.com/s/2k0c9ncckau3e3v/filter.def . My email is in that file. Feel free to incorporate my changes in the standard distribution. If you would like them in a different format, let me know, but I'm not a programmer so tools like diff and cvs confuse the heck out of me.
Cheers,
Alan.
Hi Alan, that's fantastic. I've pasted your improved Filters.def into the standard distribution:
Deletehttps://github.com/jcupitt/nip2/commit/61df9e38fd21e1a48c8319a131c6b6e90b51c1cd
Thank you!
This comment has been removed by the author.
DeleteThis comment has been removed by the author.
DeleteAlan:
ReplyDeleteIf you would be so kind as to put some of the better image resizing operations into the nip2 menu, there may be takers. For example http://www.luminous-landscape.com/forum/index.php?topic=77949.msg721095#msg721095