Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
filipemansano
Posts: 9 Joined: 2017-06-07T12:24:32-07:00
Authentication code: 1151
Post
by filipemansano » 2017-06-07T12:33:30-07:00
Hey!
I trying to remove background and horizontal line in bottom of signature
But the result contains many noises and traces of bottom horizontal line
i'm trying to get only the signature from this image
Original image
http://imgur.com/a/Zyith
(This image is a sample, the script will treat several different images with the same pattern)
Expected Result
http://imgur.com/a/6DSio
(For this result I used Adobe Photoshop)
Result using ImageMagick
http://imgur.com/a/hBPCp
Code used
Code: Select all
C:\imagick\bin\convert.exe ^
teste.png ^
-write mpr:ORG ^
( +clone ^
-negate ^
-morphology Erode rectangle:100x1 ^
-mask mpr:ORG -morphology Dilate rectangle:100x1 ^
+mask ^
)^
-compose CopyGreen -composite ^
-normalize ^
-fuzz 30000 -fill white -opaque "#47FF47" ^
-fuzz 15000 -fill white -opaque "#FF00FF" ^
-density 288 -antialias -sharpen 0x3.0 -colorspace GRAY ^
out.png
Version: ImageMagick 6.8.9-1
Last edited by
filipemansano on 2017-06-07T13:09:39-07:00, edited 1 time in total.
Bonzo
Posts: 2971 Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England
Post
by Bonzo » 2017-06-07T12:42:20-07:00
Out of interest why do you want the signature? If it is your signature you have it already from Photoshop.
filipemansano
Posts: 9 Joined: 2017-06-07T12:24:32-07:00
Authentication code: 1151
Post
by filipemansano » 2017-06-07T12:45:48-07:00
Bonzo wrote: ↑ 2017-06-07T12:42:20-07:00
Out of interest why do you want the signature? If it is your signature you have it already from Photoshop.
Our clients send the signed contract in our internal system and we want to compare their signature, for that we only need the signature, and extracting the signature with photoshop demands a lot of time and skill of the collaborators
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2017-06-07T13:35:02-07:00
try
Code: Select all
convert GvCTYAI.png -white-threshold 70% result.png
filipemansano
Posts: 9 Joined: 2017-06-07T12:24:32-07:00
Authentication code: 1151
Post
by filipemansano » 2017-06-07T13:46:28-07:00
fmw42 wrote: ↑ 2017-06-07T13:35:02-07:00
try
Code: Select all
convert GvCTYAI.png -white-threshold 70% result.png
Thanks!!
The function worked out, I did not use the value of 70% I used a value number of "10000" and solved
final code
Code: Select all
C:\imagick\bin\convert.exe ^
teste.png ^
-write mpr:ORG ^
( +clone ^
-negate ^
-morphology Erode rectangle:100x1 ^
-mask mpr:ORG -morphology Dilate rectangle:100x1 ^
+mask ^
)^
-compose CopyGreen -composite ^
-normalize ^
-fuzz 30000 -fill white -opaque "#47FF47" ^
-fuzz 15000 -fill white -opaque "#FF00FF" ^
-density 288 -antialias -sharpen 0x3.0 -colorspace GRAY ^
-white-threshold 10000 ^
out.png
filipemansano
Posts: 9 Joined: 2017-06-07T12:24:32-07:00
Authentication code: 1151
Post
by filipemansano » 2017-06-13T08:32:29-07:00
How to remove content that is circled in red in the image below
http://imgur.com/a/H5H53
In the course of the tests appeared a case where it contains some words next to the signature, tried several ways with the morphoholgy remove, but all messed up the signature, would have a way to remove these letters without affecting the signature design?
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2017-06-13T09:18:13-07:00
Post your image before you add the red. It interferes with a solution and is too hard to remove.
My suggestion is use -connected-componenets to remove small areas (the characters) and leave the one long signature. See
http://magick.imagemagick.org/script/co ... onents.php
Code: Select all
convert P6gHiPG.png \
-define connected-components:verbose=true \
-define connected-components:area-threshold=150 \
-define connected-components:mean-color=true \
-connected-components 8 \
P6gHiPG_result.png
filipemansano
Posts: 9 Joined: 2017-06-07T12:24:32-07:00
Authentication code: 1151
Post
by filipemansano » 2017-06-13T09:43:33-07:00
Sorry, this image without red circle
(
http://imgur.com/a/A4rgt )
I try to use the connected components option and I get an error
convert.exe: unrecognized option `-connected-components' @ error/convert.c/ConvertImageCommand/1156.
Version: ImageMagick 6.8.9-1 Q16 x64 2014-05-08
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2017-06-13T09:47:38-07:00
Try my command with this latest image and it should create the same as my result, but without the red on the left edge
filipemansano
Posts: 9 Joined: 2017-06-07T12:24:32-07:00
Authentication code: 1151
Post
by filipemansano » 2017-06-13T09:58:42-07:00
I tried but am getting an IM error alert, which version did you use to perform this command?
fmw42
Posts: 25562 Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA
Post
by fmw42 » 2017-06-13T10:07:08-07:00
IM 6.9.8.10 unix command. if on windows, try
Code: Select all
convert P6gHiPG.png ^
-define connected-components:verbose=true ^
-define connected-components:area-threshold=150 ^
-define connected-components:mean-color=true ^
-connected-components 8 ^
P6gHiPG_result.png
You need a version of ImageMagick that supports connected components. IM 6.8.9.10 or higher. So it looks like your 6.8.9.1 is a few versions too old. Can you upgrade?
filipemansano
Posts: 9 Joined: 2017-06-07T12:24:32-07:00
Authentication code: 1151
Post
by filipemansano » 2017-06-13T13:13:56-07:00
Yes, I upgraded to the latest version
Thank you very much! It worked out
nextbars
Posts: 1 Joined: 2018-07-23T01:48:37-07:00
Authentication code: 1152
Post
by nextbars » 2018-07-23T01:49:56-07:00
Can you guys please help me, im trying to accomplish the same with php imagick library
snibgo
Posts: 12159 Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK
Post
by snibgo » 2018-07-23T02:35:54-07:00
If this is a serious question, I suggest you consult IMagick documentation.