Re: Equivalent of ImageMagick's -fx in GrahicsMagick?
Bob Friesenhahn <[email protected]>
| Newsgroups | gmane.comp.video.graphicsmagick.help |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 10 Oct 2017, Nekomune wrote: > Hello, > > I'm wondering what the nearest equivalent of -fx is in GraphicsMagick is? > > I am trying to perform a color to black and white conversion without > using the default formula when changing colorspaces. > > In im, I run: > > convert -colorspace Gray -fx '0.4*r+0.1*g+0.4*b' in.jpg out.jpg > > But I can find no option like -fx > > The closest I have found is -recolor, where I specify a full matrix to > perform color translation in the same colorspace. But in the future, I > might want to use something more general like -fx. > > Any pointers? It is possible to do many useful things with the '-operator' option. This does not do everything in floating point at once like IM's -fx, but can be used in order. There is a performance impact in that there are multiple sweeps of the image pixels but a performance benefit that all the operations are optimized code rather than interpeted. I think that if you can get -operator to do what you want that it will execute an order of magnitude or more faster. You may also want to investigate the -hald-clut option which allows duplicating any color transform based on a transformed reference identity image. For example, you could use IM to apply the -fx operation on an reference IDENTITY image (e.g. from gm convert 'identity:[16x16]' identity.png) and then use the transformed IDENTITY image to apply the transform using -hald-clut. Bob -- Bob Friesenhahn [email protected], http://www.simplesystems.org/users/bfriesen/ GraphicsMagick Maintainer, http://www.GraphicsMagick.org/ ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot