Page 2 of 3
Re: Picking a single RED value, and all the G and B (0-255)
Posted: 2015-10-15T12:38:27-07:00
by gaylorr
fmw42 wrote:As I said that was a unix command. It does not work on windows.
try
Code: Select all
convert image -channel r -separate +channel -fill black +opaque "gray(132)" -fill white -opaque "gray(132)" result
I think that worked!!! (it's a hell of a lot closer than I got anyway
)
Thank you!
Re: Picking a single RED value, and all the G and B (0-255)
Posted: 2015-10-15T12:45:25-07:00
by snibgo
Do you want an image as the output, or text? If an image:
Should it be the same size as the input image?
Some of the input pixels have red equal to 132 (out of 255). What do you want in the corresponding output pixels?
For the inputs that don't have red=132, what do you want in the corresponding output pixels?
EDIT: Never mind, Fred seems to have understood what you want.
Re: Picking a single RED value, and all the G and B (0-255)
Posted: 2015-10-15T12:51:24-07:00
by gaylorr
thank you tho also for helping me clarify what I needed Snibgo...I appreciate the help always...
In the above provided solution by Fmw42, if I wanted to have it choose red values that were say between 125 and 145 (thus capturing the range of R) could this command line script be modified to do that as well? (versus only capturing "132")
Re: Picking a single RED value, and all the G and B (0-255)
Posted: 2015-10-15T13:06:44-07:00
by snibgo
"-fuzz 7" may do what you want.
Re: Picking a single RED value, and all the G and B (0-255)
Posted: 2015-10-15T14:54:40-07:00
by fmw42
snibgo wrote:"-fuzz 7" may do what you want.
Only on Q8 systems. On Q16 that would be 7 out of 65535. So better to use percent such as 7/255 => 2.7451%
Re: Picking a single RED value, and all the G and B (0-255)
Posted: 2015-10-15T15:02:03-07:00
by snibgo
Ah, yes, true.
Re: Picking a single RED value, and all the G and B (0-255)
Posted: 2015-10-18T08:28:16-07:00
by gaylorr
snibgo wrote:"-fuzz 7" may do what you want.
I did try to understand the "fuzz" factor, but it seemed a bit not really controllable accurately...
Re: Picking a single RED value, and all the G and B (0-255)
Posted: 2015-10-18T08:31:30-07:00
by gaylorr
fmw42 wrote:snibgo wrote:"-fuzz 7" may do what you want.
Only on Q8 systems. On Q16 that would be 7 out of 65535. So better to use percent such as 7/255 => 2.7451%
Ahhhh....now I see how to lock that down...thanks!
Re: Picking a single RED value, and all the G and B (0-255)
Posted: 2015-10-18T08:33:51-07:00
by gaylorr
Where could I put the -fuzz in this line:
convert filename.dds -channel r -separate +channel -fill black +opaque "gray(132)" -fill white -opaque "gray(132)" filename.png
Re: Picking a single RED value, and all the G and B (0-255)
Posted: 2015-10-18T09:41:14-07:00
by snibgo
Anywhere before "+opaque".
Re: Picking a single RED value, and all the G and B (0-255)
Posted: 2015-10-18T10:02:44-07:00
by gaylorr
snibgo wrote:Anywhere before "+opaque".
Thank you Snibgo...and for all the replies and patience to my Noobism
I really really love what I have found out that ImageMagick can do...just going thru and trying to read every page of options, tools, example...I mean...this opens up so much more for me than photoshop (not that it isn't amazing in how far it has come over the years too) but I work in the visual simulation world, and once I know this tool much better, I plan on never having to use Pshop Actions ever again! I can't batch using IM so much more efficiently and repeatably once I understand more.
Anyway...thank you again for helping me get started.
Rick
Re: Picking a single RED value, and all the G and B (0-255)
Posted: 2015-10-18T13:07:38-07:00
by gaylorr
I think the command line argument / script is giving me colors I do not want...
convert file-in.dds -channel r -separate +channel -fill black -fuzz 5% +opaque "gray(132)" -fill white -opaque "gray(132)" file-out.png
the RED color channel is the only color that the range can be selected from based on the formula:
color r = face->normal().z * 127.0 + 127.5;
color g = face->normal().y * 127.0 + 127.5;
color b = face->normal().x * 127.0 + 127.5;
I am trying to select all vertical faces (within a 5ยบ margin of error) in my model's texture.
the gray(132) as I read it, means:
gray = rgb(126, 126, 126)...
what I want is:
rgb(132, *, *)
OR an exact colors: (as an example)
R=127-224
G=*
B=*
Is this possible?
Re: Picking a single RED value, and all the G and B (0-255)
Posted: 2015-10-18T13:26:39-07:00
by fmw42
It is giving you 5% on each side of 132. In this context it is only 5% on each side of red=132 due to the use of -channel r -separate. You must compute the range of values on each side of the center of the range and use the center of the range as the gray value.
For example 105% of 132 = 139 and 95% of 132 = 125 (rounded to the nearest integer). So you will get red in the range of 125 to 139 and all values of green and blue for those red values.
Re: Picking a single RED value, and all the G and B (0-255)
Posted: 2015-10-18T13:46:43-07:00
by gaylorr
fmw42 wrote:It is giving you 5% on each side of 132. In this context it is only 5% on each side of red=132 due to the use of -channel r -separate. You must compute the range of values on each side of the center of the range and use the center of the range as the gray value.
For example 105% of 132 = 139 and 95% of 132 = 125 (rounded to the nearest integer). So you will get red in the range of 125 to 139 and all values of green and blue for those red values.
Ok thank you...
Perhaps in a later release there could be a -range(125-132) ?
Rick
Re: Picking a single RED value, and all the G and B (0-255)
Posted: 2015-10-18T14:15:27-07:00
by snibgo
fmw42 wrote:For example 105% of 132 = 139 and 95% of 132 = 125 (rounded to the nearest integer).
?????
"-fuzz 5%" means 5% of quantum. If quantum is 255, then 5% of this is plus or minus 13. If the central value is 132, we will get values of 119 to 145.
If the desired range is 125 to 132, then the central value is 128.5, and the percentage fuzz should be 100*3.5/255 = 1.3725%