It is currently Wed Aug 19, 2026 1:45 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: help with commandline g'mic
PostPosted: Fri Dec 12, 2014 3:17 pm  (#1) 
Offline
GimpChat Member

Joined: Dec 05, 2014
Posts: 14
Hi,

I hope someone will be kind enough to let me know what I'm doing wrong. I've always used g'mic through gimp before but I now have a need to use it at the commandline. Right now I'm just trying to get the -plasma command to look the same as in gimp. If I run that filter on a 400x400 image in gimp I get the gimp-gmic-plasma.jpg output.

I'm looking to get the same look from the command line, so right now I'm doing this:

gmic 400,400,1,3 -plasma 0.5,0,8 -o plasma.jpg

which I believe is the same parameters as when run through gimp, but my output is the gmic-plasma.jpg file.

Any ideas on why I'm getting such different results?

Thanks,
Kevin


Attachments:
gimp-gmic-plasma.jpg
gimp-gmic-plasma.jpg [ 24.3 KiB | Viewed 3493 times ]
gmic-plasma.jpg
gmic-plasma.jpg [ 125.63 KiB | Viewed 3493 times ]
Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: help with commandline g'mic
PostPosted: Fri Dec 12, 2014 3:47 pm  (#2) 
Offline
GimpChat Member
User avatar

Joined: Nov 16, 2011
Posts: 5127
Location: Metro Vancouver, BC
Have a look at this G'MIC -plasma tut by Garry Osgood.

_________________
Image
Gimp 2.8.18, Linux, median user
Gimp Chat Tutorials Index
Spirit Bear (Kermode)


Top
 Post subject: Re: help with commandline g'mic
PostPosted: Fri Dec 12, 2014 3:49 pm  (#3) 
Offline
GimpChat Member
User avatar

Joined: Jan 03, 2011
Posts: 1656
Basically, you need to renormalize the values of your output image in [0,255] before saving it as a jpeg :

$ gmic 400,400,1,3 -plasma 1,1 -n 0,255 -o out.jpg


Top
 Post subject: Re: help with commandline g'mic
PostPosted: Fri Dec 12, 2014 5:21 pm  (#4) 
Offline
GimpChat Member
User avatar

Joined: Mar 15, 2014
Posts: 115
Location: Brooklyn, NY
And, less than basically (more than basically?) essential background for gimp-gmic filter users venturing for the first time into the strange and wonderful world of the gmic command line.

  1. Introduction to the G'MIC image which discusses in a general way how G'MIC represents images; it is quite different from Gimp's representation, so the matter of data conversion is ever-present between Gimp and G'MIC.
  2. Images as Datasets specifically goes into the calamity you experienced; the example there actually illustrates the problem you had.
  3. Dinasset's Tips and Curiosities Very practical, hard-earned pointers from one fellow who leaves the safe harbor of Gimp-G'MIC filters from time to time and ventures out onto the high seas of the command language.
  4. Normalize is the tutorial on using this -n 0,255 command.
The particular problem you observe stems from an inappropriate data conversion. the gmic command line devotes four time the number of bits to a value stored in a pixel channel than does Gimp, allowing for very high precision calculations within G'MIC with very little loss stemming from rounding error. Technically, gmic harnesses 32 bits-per-value floating point formatted numbers, Gimp harnesses only 8 bit unsigned integers (unless you use the GEGL parts). When you employ the Gimp-G'MIC plug in and the filters it hosts, that framework handles the matter of data conversion for you. It is akin to using an automatic transmission in an automobile. When you use the gmic command line yourself, you are outside of that framework and are obliged to be more conscientious in the matter of data management. You are driving a car with a manual transmission; you have to use the clutch and shift gears yourself. Ronounours gave you the essential command to "clutch and shift gears" -n 0,255 which commands G'MIC to reformat the data stored in pixel channels from 32 bit floating point to 8 bit unsigned integers. That involves data loss, by the way, so gmic expects to be told; it won't carry out destruction of information without your permission.

It is fair to ask why isn't such a data conversion always automatic? Well, generally, G'MIC lives a large and contented life outside of Gimp, where automatic conversions from high-to-low formats would annoy people who require high precision image representations. Normalization becomes a frequent necessity only where G'MIC's path crosses those of eight-bit paint programs. One of the reasons the Gimp-G'MIC plug-in came into existence was so that people could make use of scripts written in the gmic command language without having to worry about data conversion. Having ventured outside of that cloister, you'll have access to the full power of the underlying gmic command language, but it does require a more astute awareness of the format of your image data, and what format you might want it to be in.

It won't be long before data awareness will become second nature to you, and you'll invoke commands like -normalize and -cut without thinking much about them. This is probably the biggest hurdle that people new to the command line tool have to leap. Well, now you know the height and breadth of the thing and you'll be over it in no time. Welcome to the command line tool.

Garry


Top
 Post subject: Re: help with commandline g'mic
PostPosted: Sat Dec 13, 2014 5:11 am  (#5) 
Offline
GimpChat Member
User avatar

Joined: Jan 03, 2011
Posts: 1656
Thanks Garry (as always) for the very detailed explanation :)


Top
 Post subject: Re: help with commandline g'mic
PostPosted: Sun Dec 14, 2014 12:37 pm  (#6) 
Offline
GimpChat Member

Joined: Dec 05, 2014
Posts: 14
Thank you all very much! That's what I needed, it's working great now.

Thanks for g'mic, I've been using it for a long time, lots of great filters in there.


Top
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group