Sophisticated fuzz with HSL definition?
Re: Sophisticated fuzz with HSL definition?
Oh so. I have to remember there must not be space after ^ it was not visible and this did not come to my mind.
I almost have what I wanted, but I am not satisfied with the threshold. I must do more complicated calculation to get rid of #FFE98E rectangles. My idea is to select:
convert mapka.png -write mpr:input +delete ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFE168" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#E5bC4C" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFF1B3" ) ^
-evaluate-sequence add -blur 0x1.6 -threshold 25.5%% ^
REM Or use Faster method to extend the area?
-write mpr:basic
and then:
( mpr:input -fuzz 2%% -fill black +opaque "#FFE98E" ) ^
-blur 0x1.6 -threshold 25.5%%
REM extend the mask for blue rectangle too
-write mpr:extra_add
then When I have both layers extended I need to compose them with multiply effect so the blue rectangle should no more exists. It will disappear from the mask. And then I need to contract the final mask about 5 pixels. It is harder task, but you could help me how to make this 3 parts working together in one command.
I almost have what I wanted, but I am not satisfied with the threshold. I must do more complicated calculation to get rid of #FFE98E rectangles. My idea is to select:
convert mapka.png -write mpr:input +delete ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFE168" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#E5bC4C" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFF1B3" ) ^
-evaluate-sequence add -blur 0x1.6 -threshold 25.5%% ^
REM Or use Faster method to extend the area?
-write mpr:basic
and then:
( mpr:input -fuzz 2%% -fill black +opaque "#FFE98E" ) ^
-blur 0x1.6 -threshold 25.5%%
REM extend the mask for blue rectangle too
-write mpr:extra_add
then When I have both layers extended I need to compose them with multiply effect so the blue rectangle should no more exists. It will disappear from the mask. And then I need to contract the final mask about 5 pixels. It is harder task, but you could help me how to make this 3 parts working together in one command.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Sophisticated fuzz with HSL definition?
mpr: format images automatically disappear when the command line finishes. You cannot save it from one command to another.
Re: Sophisticated fuzz with HSL definition?
One more problem. Now I need to get mask which will have red instead white
I do the threshold but I need it come not in white but in different color, e.g red. Is there simple way how to replace the white for red, without using -fuzz and -fill? I believe that all colors in image are indexed in the image header so I just want to replace color in the header, no change to references in the bitmap array.
Code: Select all
convert mapka.png -fuzz 8%% -fill black +opaque "#5189CF" ^
-blur 0x1.0 -threshold 4.5%% highway_result_extra_add.png
Re: Sophisticated fuzz with HSL definition?
Also, I need to generate two masks. One with less blur/threshold one with bigger:
So is it possible to make one command? Not to generate those 6 images but only 3 images. But I would like first evaluate-sequence first, and save to one file and then evaluate-sequence second and save to second file.
Code: Select all
convert map.png -write mpr:input +delete ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFE168" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#E5bC4C" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFF1B3" ) ^
-evaluate-sequence add -blur 0x1.6 -threshold 25%% highway_result_basic_1.png
Code: Select all
convert map.png -write mpr:input +delete ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFE168" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#E5bC4C" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFF1B3" ) ^
-evaluate-sequence add -blur 0x2.4 -threshold 2.5%% highway_result_basic_2.png
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Sophisticated fuzz with HSL definition?
try this, but not tested, since I am on Mac not Windows. Note the use of -write and then -delete 0-3
Code: Select all
convert map.png -write mpr:input +delete ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFE168" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#E5bC4C" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFF1B3" ) ^
-evaluate-sequence add -blur 0x1.6 -threshold 25%% -write highway_result_basic_1.png ^
-delete 0-3 ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFE168" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#E5bC4C" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFF1B3" ) ^
-evaluate-sequence add -blur 0x2.4 -threshold 2.5%% highway_result_basic_2.png
Re: Sophisticated fuzz with HSL definition?
Wow . Works both:
It's great. I worried that it would not be possible.
Also can you answer my question about -fill? What does the fill actually do? If used without -fuzz does it fill every pixel in bitmap array or does it replace only the one color value in the image header
Code: Select all
convert map.png -write mpr:input +delete ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFE168" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#E5bC4C" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFF1B3" ) ^
-evaluate-sequence add -blur 0x1.6 -threshold 25%% -write highway_result_basic_1.png ^
-evaluate-sequence add -blur 0x2.4 -threshold 2.5%% highway_result_basic_2.png
Also can you answer my question about -fill? What does the fill actually do? If used without -fuzz does it fill every pixel in bitmap array or does it replace only the one color value in the image header
Last edited by VanGog on 2014-06-10T10:37:09-07:00, edited 1 time in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Sophisticated fuzz with HSL definition?
convert map.png -write mpr:input +delete ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFE168" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#E5bC4C" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFF1B3" ) ^
-evaluate-sequence add -blur 0x2.1 -threshold 9%% ^
-blur 0x2.6 -threshold 70%% -write highway_result_basic_1.png ^
-evaluate-sequence add -blur 0x2.4 -threshold 2.5%% highway_result_basic_2.png
Delete the first resulting image from memory after writing it to disk
Code: Select all
convert map.png -write mpr:input +delete ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFE168" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#E5bC4C" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFF1B3" ) ^
-evaluate-sequence add -blur 0x2.1 -threshold 9%% ^
-blur 0x2.6 -threshold 70%% -write highway_result_basic_1.png +DELETE ^
-evaluate-sequence add -blur 0x2.4 -threshold 2.5%% highway_result_basic_2.png
-fill will replace the all (rgb as opposed to hsl) colors within fuzz XX% of your selected color with black
Re: Sophisticated fuzz with HSL definition?
Yet one more problem with my code:
When I change value 70%% to 90%% it will affect both files. But I need to affect only the file highway_result_basic_1.png when I change this value, because I want the last line to work with images 1-3 not with the last image.
Code: Select all
convert map.png -write mpr:input +delete ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFE168" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#E5bC4C" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFF1B3" ) ^
-evaluate-sequence add -blur 0x2.1 -threshold 9%% ^
-blur 0x2.6 -threshold 70%% -write highway_result_basic_1.png ^
-evaluate-sequence add -blur 0x2.4 -threshold 2.5%% highway_result_basic_2.png
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Sophisticated fuzz with HSL definition?
I explained the fix in my previous message. Please read carefully. See the note about +delete
Re: Sophisticated fuzz with HSL definition?
You mean like this?
But this still changes the highway_result_basic_2.png . The contraction of first file effects the second file which should not be contracted.
Code: Select all
convert map.png -write mpr:input +delete ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFE168" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#E5bC4C" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFF1B3" ) ^
-evaluate-sequence add -blur 0x2.1 -threshold 9%% ^
-blur 0x2.6 -threshold 90%% -write highway_result_basic_1.png ^
-delete 3 ^
-evaluate-sequence add -blur 0x2.4 -threshold 2.5%% highway_result_basic_2.png
Last edited by VanGog on 2014-06-10T12:10:06-07:00, edited 1 time in total.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Sophisticated fuzz with HSL definition?
Code: Select all
convert map.png -write mpr:input +delete ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFE168" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#E5bC4C" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFF1B3" ) ^
-evaluate-sequence add -blur 0x2.1 -threshold 9%% ^
-blur 0x2.6 -threshold 70%% -write highway_result_basic_1.png ^
-evaluate-sequence add -blur 0x2.4 -threshold 2.5%% highway_result_basic_2.png
See "-clone" for a solution, as well as "-delete".
snibgo's IM pages: im.snibgo.com
Re: Sophisticated fuzz with HSL definition?
I still got many errors so how should the -clone look like? I give it before -evaluate-sequence but it will probably join the cloned layers too. How to do it correctly?snibgo wrote: The first "-evaluate-sequence add" will replace all of the images so far. So the second "-evaluate-sequence add" has only one image to work with, and that image is the result of the first "add".
See "-clone" for a solution, as well as "-delete".
Code: Select all
convert map.png -write mpr:input +delete ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFE168" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#E5bC4C" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFF1B3" ) ^
( -clone 0-2 ) ^
-evaluate-sequence add -blur 0x2.1 -threshold 9%% ^
-blur 0x1.6 -threshold 90%% -write highway_result_basic_1.png ^
-evaluate-sequence add -blur 0x1.0 -threshold 25%% highway_result_basic_2.png
Edit:
Yet I got idea to try MPR because I cannot find out how to use the clone or parenthesis in this command, so I tried this, getting error that it requires -write
Code: Select all
convert map.png -write mpr:input +delete ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFE168" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#E5bC4C" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFF1B3" ) ^
-evaluate-sequence add ^
-write mpr:basic ^
mpr:basic -blur 0x2.1 -threshold 9%% ^
-blur 0x1.6 -threshold 90%% -write highway_result_basic_1.png ^
mpr:basic -evaluate-sequence add -blur 0x1.0 -threshold 25%% highway_result_basic_2.png
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Sophisticated fuzz with HSL definition?
You have missed the key point of my earlier code to fix your problem. You need to delete the file after writing it to disk, so that it does not get kept in memory and used by the second -evaluate-sequence. Writing a file to disk (using -write) does not automatically remove it from the command line. So there is still a file in memory from the first -evaluate-sequence. I have highlighted the important changes and the one you missed is in red.
Also you cannot have a blank line in the middle of code because there is a new line without a new line character (^)
- convert map.png -write mpr:input +delete ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFE168" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#E5bC4C" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFF1B3" ) ^
-evaluate-sequence add -blur 0x2.1 -threshold 9%% ^
-blur 0x2.6 -threshold 70%% -write highway_result_basic_1.png +delete ^
-evaluate-sequence add -blur 0x2.4 -threshold 2.5%% highway_result_basic_2.png
Also you cannot have a blank line in the middle of code because there is a new line without a new line character (^)
Re: Sophisticated fuzz with HSL definition?
The empty line was only for stylistic reasons here on forum to separate the two steps visually.
I think I have tried your last code already before and it did not work. I am going to try again.
Yes, i recalled I tried it and it produced error message. I was not able to use the +delete but only -delete 3 because +delete produced some error message. I written that it produced error. Now I tried again and the error of your code is:
I thought that when I called -evaluate-sequence first time, so the images in parenthesis will be removed by the command and will be changed to one image. If this is truth - as it looks it is - than this is reason of my error. I try to explain that this causes depended action. action 2 is depended on action 1, action 3 is depended on action 2. This is not what I want. I want: action 2 to be depended on action 1, action 3 to be depended on action 1. In other words, now I need: Create 3 images and join them. The resulting image save to memory let's call it "basic", this is action 1. Then I create blur and extend the image, then I blur and contract the image and I save it. (Possibly to remove 2nd image now from memory) This is action 2. Last action is separated and need to take the "basic" image from memory. I create blur and extend the image and save it to second file.
The last code of mine tried to fix it with clone, but I cannot find example how to use the clone or parenthesis in similar way. Snibgo written good advice to me and I think that he understood me what I want so I continued to try it with clone. He wrote I should use -clone and -delete but I cannot find out how to use them in this case. I checked the examples of IM v6.
I think I have tried your last code already before and it did not work. I am going to try again.
Yes, i recalled I tried it and it produced error message. I was not able to use the +delete but only -delete 3 because +delete produced some error message. I written that it produced error. Now I tried again and the error of your code is:
Code: Select all
convert map.png -write mpr:input +delete ( mpr:input -fuzz 2% -fill black
+opaque "#FFE168" ) ( mpr:input -fuzz 2% -fill black +opaque "#E5bC4C" ) ( mpr:input -fuzz 2% -fill black +opaque "#FFF1B3" ) -evaluate-sequence add -blur 0x2.1 -threshold 9% -blur 0x2.6 -threshold 70% -write highway_result_basic_1.png +delete -evaluate-sequence add -blur 0x2.4 -threshold 2.5% highway_result_basic_2.png convert.exe: missing an image filename `highway_result_basic_2.png' @ error/convert.c/ConvertImageCommand/3016.
The last code of mine tried to fix it with clone, but I cannot find example how to use the clone or parenthesis in similar way. Snibgo written good advice to me and I think that he understood me what I want so I continued to try it with clone. He wrote I should use -clone and -delete but I cannot find out how to use them in this case. I checked the examples of IM v6.
Last edited by VanGog on 2014-06-11T01:49:09-07:00, edited 1 time in total.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Sophisticated fuzz with HSL definition?
Earlier, you said you wanted to combine:
... and ...
The first 4 lines of each command are the same, so this combines them:
Each "-evaluate-sequence add" operates on the same three inputs. So, instead, we could "-evaluate-sequence add" just once:
Personally, I don't combine commands until I am certain they do what I want them to do.
Code: Select all
convert map.png -write mpr:input +delete ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFE168" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#E5bC4C" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFF1B3" ) ^
-evaluate-sequence add -blur 0x1.6 -threshold 25%% highway_result_basic_1.png
Code: Select all
convert map.png -write mpr:input +delete ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFE168" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#E5bC4C" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFF1B3" ) ^
-evaluate-sequence add -blur 0x2.4 -threshold 2.5%% highway_result_basic_2.png
Code: Select all
convert map.png -write mpr:input +delete ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFE168" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#E5bC4C" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFF1B3" ) ^
( -clone 0-2 ^
-evaluate-sequence add -blur 0x1.6 -threshold 25%% ^
-write highway_result_basic_1.png ^
+delete ^
) ^
-evaluate-sequence add -blur 0x2.4 -threshold 2.5%% highway_result_basic_2.png
Code: Select all
convert map.png -write mpr:input +delete ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFE168" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#E5bC4C" ) ^
( mpr:input -fuzz 2%% -fill black +opaque "#FFF1B3" ) ^
-evaluate-sequence add ^
( -clone 0 ^
-blur 0x1.6 -threshold 25%% ^
-write highway_result_basic_1.png ^
+delete ^
) ^
-blur 0x2.4 -threshold 2.5%% highway_result_basic_2.png
snibgo's IM pages: im.snibgo.com