It is currently Fri Jul 19, 2024 10:19 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 15 posts ] 
Author Message
 Post subject: G'MIC command like "gimp-by-color-select" ?
PostPosted: Mon Oct 13, 2014 10:38 am  (#1) 
Offline
GimpChat Member

Joined: Oct 11, 2014
Posts: 82
It's possible in Gmic something like:

(gimp-selection-none img)
(gimp-by-color-select layer
'(250 250 250) 36 0 TRUE FALSE 0 FALSE
)
(gimp-selection-invert img)
(gimp-selection-none img)

example:

[0]
-something_select_bycolor[1] rrr, ggg, bbb, %tolerance
-something_inverte_selection[1]
-operation[1] ....
-operation[2] ....
-something_selection_none[1]
-blend[0,1]


Thank's.


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: G'MIC command like "gimp-by-color-select" ?
PostPosted: Mon Oct 13, 2014 11:09 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: Jan 03, 2011
Posts: 1656
There is a command '-select_color' that can do this job :

Quote:
$ gmic -h select_color

gmic: GREYC's Magic for Image Computing.

Version 1.6.0.2 (beta), Copyright (c) 2008-2014, David Tschumperle.
(http://gmic.eu/)

-select_color:
tolerance[%]>=0,col1,..,colN

Select pixels with specified color in selected images.

Example: image.jpg --select_color 40,204,153,110

Tutorial: http://gmic.sourceforge.net/tutorial/_s ... olor.shtml


Top
 Post subject: Re: G'MIC command like "gimp-by-color-select" ?
PostPosted: Mon Oct 13, 2014 11:26 am  (#3) 
Offline
GimpChat Member

Joined: Oct 11, 2014
Posts: 82
Ronounours wrote:


Thank's.
I tried in reference.shtml but I missed -select_color ....


Top
 Post subject: Re: G'MIC command like "gimp-by-color-select" ?
PostPosted: Mon Oct 13, 2014 11:53 am  (#4) 
Offline
GimpChat Member

Joined: Oct 11, 2014
Posts: 82
Some bugs?


Attachments:
selcolor.jpg
selcolor.jpg [ 35 KiB | Viewed 2611 times ]
Top
 Post subject: Re: G'MIC command like "gimp-by-color-select" ?
PostPosted: Mon Oct 13, 2014 12:50 pm  (#5) 
Offline
GimpChat Member

Joined: Oct 11, 2014
Posts: 82
Ok, found the solution.

Attachment:
ok.jpg
ok.jpg [ 150.98 KiB | Viewed 2588 times ]


Now how to use the mask [1] to apply a command/filter to [0] only in white [1] areas?
I search "mask" "alpha" in reference.shtml but nothing help me ...

Thank's.


Top
 Post subject: Re: G'MIC command like "gimp-by-color-select" ?
PostPosted: Mon Oct 13, 2014 2:23 pm  (#6) 
Offline
GimpChat Member
User avatar

Joined: Jan 03, 2011
Posts: 1656
The general idea to do that, is to apply the effect on the whole image, then copy only the masked part of the result to the initial image [0].
Example, with a blur, you can add this to your G'MIC command to do the trick.

--blur[0] 10 -j[0] [-1],0,0,0,0,1,[1] -rm[-1]


Top
 Post subject: Re: G'MIC command like "gimp-by-color-select" ?
PostPosted: Mon Oct 13, 2014 2:51 pm  (#7) 
Offline
GimpChat Member

Joined: Oct 11, 2014
Posts: 82
thanks again for the tips.
I found this solution that seems to work

--select_color[0]  20%,250,250,250
-normalize[1] 0,255
-negative[1]
--append[0,1] c
#-drgba
-b[2] 16
--blend[0,2] alpha,1
-remove_opacity[3]
-d0


Attachments:
02.jpg
02.jpg [ 41.19 KiB | Viewed 2545 times ]
Top
 Post subject: Re: G'MIC command like "gimp-by-color-select" ?
PostPosted: Tue Oct 14, 2014 6:07 am  (#8) 
Offline
GimpChat Member

Joined: Oct 11, 2014
Posts: 82
Ronounours wrote:
Example, with a blur, you can add this to your G'MIC command to do the trick.

--blur[0] 10 -j[0] [-1],0,0,0,0,1,[1] -rm[-1]



with -image command,
not exactly the same result ....


Attachments:
image-j.jpg
image-j.jpg [ 129.02 KiB | Viewed 2449 times ]
Top
 Post subject: Re: G'MIC command like "gimp-by-color-select" ?
PostPosted: Tue Oct 14, 2014 7:06 am  (#9) 
Offline
GimpChat Member
User avatar

Joined: Jan 03, 2011
Posts: 1656
Because in that case, you don't have to normalize the mask image in [0,255].
The values can be left in [0,1].


Top
 Post subject: Re: G'MIC command like "gimp-by-color-select" ?
PostPosted: Tue Oct 14, 2014 8:00 am  (#10) 
Offline
GimpChat Member

Joined: Oct 11, 2014
Posts: 82
Ronounours wrote:
Because in that case, you don't have to normalize the mask image in [0,255].
The values can be left in [0,1].


Thanks again.
Same result, but with fewer steps needed:
Attachment:
_j_test_ok.jpg
_j_test_ok.jpg [ 79.49 KiB | Viewed 2433 times ]


Top
 Post subject: Re: G'MIC command like "gimp-by-color-select" ?
PostPosted: Wed Oct 15, 2014 9:51 am  (#11) 
Offline
GimpChat Member

Joined: Oct 11, 2014
Posts: 82
I did some test,
a flou/soft focus filter with edges protection
Attachment:
step1.jpg
step1.jpg [ 102.06 KiB | Viewed 1263 times ]

the "mask" is --gimp_gradient_norm[0]

with RGBA and -blend alpha works as expected:
Attachment:
step2.jpg
step2.jpg [ 70.13 KiB | Viewed 1263 times ]


instead with -j the result is bad:
Attachment:
step_w_j.jpg
step_w_j.jpg [ 79.92 KiB | Viewed 1263 times ]


so I wrote the filter using the first method.
Any advice?
Thanks.


Top
 Post subject: Re: G'MIC command like "gimp-by-color-select" ?
PostPosted: Thu Oct 16, 2014 2:40 am  (#12) 
Offline
GimpChat Member
User avatar

Joined: Jan 03, 2011
Posts: 1656
The method with '-j' assumes that your mask has values in [0,1].
For different values, you can expect weird pixels appearing. Have you checked this is indeed the case ?


Top
 Post subject: Re: G'MIC command like "gimp-by-color-select" ?
PostPosted: Thu Oct 16, 2014 4:39 am  (#13) 
Offline
GimpChat Member

Joined: Oct 11, 2014
Posts: 82
understood, -j only to sharp masks [0,1].
For soft mask, alpha channel is the way.
thanks to the availability.


Top
 Post subject: Re: G'MIC command like "gimp-by-color-select" ?
PostPosted: Thu Oct 16, 2014 6:12 am  (#14) 
Offline
GimpChat Member
User avatar

Joined: Jan 03, 2011
Posts: 1656
No, -j also works with smooth masks. But the mask values must be kept in the [0,1] interval.


Top
 Post subject: Re: G'MIC command like "gimp-by-color-select" ?
PostPosted: Fri Oct 17, 2014 10:48 am  (#15) 
Offline
GimpChat Member

Joined: Oct 11, 2014
Posts: 82
Ronounours wrote:
No, -j also works with smooth masks. But the mask values must be kept in the [0,1] interval.



ok this is a test
Attachment:
more.jpg
more.jpg [ 114.57 KiB | Viewed 1198 times ]


Mask255 [1] is a 0,255 16 level mask.
--normalize[1] 0,1
should reduce the interval in [0,1] range in new image [3]
but the result is bad ...

I suppose that the pixels of the mask should have a value of 0 or 1 (sharp mask),
not 0 ... 0.2 ... 0.8 ... 1 (soft).

Or something wrong?


Top
Post new topic Reply to topic  [ 15 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) How to select color from light spectrum graph ?

2

No new posts Attachment(s) GEGL Color Light Fusion (12 blend modes for color overlay)

9

No new posts Attachment(s) Background color chanage and typed text color change

8

No new posts Attachment(s) HELP - SEARCH AND RUN A COMMAND

6

No new posts How do you run GIMP from the command line?

1



* Login  



Powered by phpBB3 © phpBB Group