Clean shadow around text

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?".
Post Reply
dattatembare
Posts: 5
Joined: 2018-06-27T13:11:39-07:00
Authentication code: 1152

Clean shadow around text

Post by dattatembare »

I'm using IM:ImageMagick-7.0.7-Q16 on Windows
I have processed an image(https://www.dropbox.com/s/eqm7wgd8bbeqb ... l.png?dl=0)
using

Code: Select all

convert original.png -brightness-contrast 5 -depth 8 -quality 100 -morphology Smooth Ring:1 result.png 
I have a shadow around my text, I want to make it clear so that tesseract can return exact text.

Result image is like - https://www.dropbox.com/s/0k10yfllltmf1 ... t.png?dl=0

I tried -sharpen 0x2.0 and -unsharp 25x25, but didn't work
Last edited by dattatembare on 2018-06-27T13:57:31-07:00, edited 3 times in total.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Clean shadow around text

Post by snibgo »

snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Clean shadow around text

Post by fmw42 »

You will need to post your images to some free hosting service and put the URLs here. This forum does not allow direct image upload/storage.

What is your Imagemagick version and platform?
dattatembare
Posts: 5
Joined: 2018-06-27T13:11:39-07:00
Authentication code: 1152

Re: Clean shadow around text

Post by dattatembare »

@snibgo Thanks! for notes
@fmw42 I have updated my original post
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Clean shadow around text

Post by fmw42 »

try

Code: Select all

magick original.png -threshold 50% result.png
Adjust the threshold as desired to potentially improve the result.
dattatembare
Posts: 5
Joined: 2018-06-27T13:11:39-07:00
Authentication code: 1152

Re: Clean shadow around text

Post by dattatembare »

After using

Code: Select all

convert original.png -threshold 50% result-4.png
Result is poor than my original script https://www.dropbox.com/s/yuxg42kz595f4 ... 4.png?dl=0
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Clean shadow around text

Post by fmw42 »

My result is better than the link to your result in your original post at the top. Your latest link does not look like the result you originally posted.

I have no other suggestions to offer.
dattatembare
Posts: 5
Joined: 2018-06-27T13:11:39-07:00
Authentication code: 1152

Re: Clean shadow around text

Post by dattatembare »

I didn't get you what you mean.

I tried

Code: Select all

convert original.png -depth 8 -quality 100 -morphology Smooth Ring:1 -negate -lat 25x30+20% -negate result-6.png
and result is much better.

Result link https://www.dropbox.com/s/ulg4u2zcravn8 ... 6.png?dl=0
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Clean shadow around text

Post by fmw42 »

My result was better than your original result that you posted at https://www.dropbox.com/s/0k10yfllltmf1 ... t.png?dl=0. Perhaps you have found a better method than your original post and even my method. Or perhaps your original result was an incorrect post, since it looks much like the source image.
Post Reply