[solved] Blurred text cut off around edges: Best way to fix?

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
mhulse
Posts: 61
Joined: 2016-03-17T18:46:22-07:00
Authentication code: 1151

[solved] Blurred text cut off around edges: Best way to fix?

Post by mhulse »

Hello,

My code:

Code: Select all

convert \
-background none \
-pointsize 500 \
-gravity center \
-fill black \
-interline-spacing -30 \
-blur 0x16 \
label:"${utility.addBreaks('This is my super duper cool title that is long', 5)}" \
${shared.dirFiles}${shared.dirCover}title.png
Image

What would be the best way to avoid the blur from being cut off?

Thanks!

Code: Select all

Version: ImageMagick 6.9.5-10 Q16 x86_64 2016-09-21 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules
Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib
Last edited by mhulse on 2016-09-29T20:58:15-07:00, edited 1 time in total.
Homebrew-installed ImageMagick 7.0.8-27 Q16 x86_64 2019-02-12 | macOS Mojave | MacBook Pro
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: Blurred text cut off around edges: Best way to fix?

Post by GeeMack »

mhulse wrote:What would be the best way to avoid the blur from being cut off?
First thing I'd try there is adding a border of at least the size of your blur, maybe even a few pixels more. Add that border after you make the label, and do your blur operation after that.

Code: Select all

... label:"Label Words" -bordercolor none -border 20x20 -blur 0x16 ...
mhulse
Posts: 61
Joined: 2016-03-17T18:46:22-07:00
Authentication code: 1151

Re: Blurred text cut off around edges: Best way to fix?

Post by mhulse »

GeeMack wrote:
mhulse wrote:What would be the best way to avoid the blur from being cut off?
First thing I'd try there is adding a border of at least the size of your blur, maybe even a few pixels more. Add that border after you make the label, and do your blur operation after that.

Code: Select all

... label:"Label Words" -bordercolor none -border 20x20 -blur 0x16 ...
Ahhhhh, that did it! Thanks so much GeeMack, I really appreciate the help!!!!!

Here's my complete example (please let me know if this could be optimized or if I am doing something wrong/oddly):

Code: Select all

convert \
-background none \
-font "${shared.dirFonts}Roboto Condensed/RobotoCondensed-Regular.ttf" \
-pointsize 500 \
-gravity Center \
-interline-spacing -30 \
-bordercolor none \
-strokewidth 16 \
\\( \
	-border 200x200 \
	-stroke black \
	label:"${title}" \
	-blur 0x32 \
\\) \
\\( \
	-border 200x200 \
	-stroke none \
	-fill white \
	label:"${title}" \
\\) \
-flatten \
+repage \
${shared.dirFiles}${shared.dirCover}title.png
Note: The above is used in a JavaScript template literal string, hence the double backslashes.

End result:

Image

I love ImageMagick!!!!!

Thanks again GeeMack!!!
Homebrew-installed ImageMagick 7.0.8-27 Q16 x86_64 2019-02-12 | macOS Mojave | MacBook Pro
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: Blurred text cut off around edges: Best way to fix?

Post by GeeMack »

mhulse wrote:Here's my complete example (please let me know if this could be optimized or if I am doing something wrong/oddly):
I think both of your "-border" operations should come immediately after creating each label. It might work the way you have it, but normally you'd want to put that border around something that already exists. A version update, adding other operations to the label, or migrating to IM7 could possibly break your code the way you have it.

Code: Select all

...
-stroke ... \
-fill ... \
label: ... \
-border ... \
-blur ... \
...
mhulse
Posts: 61
Joined: 2016-03-17T18:46:22-07:00
Authentication code: 1151

Re: Blurred text cut off around edges: Best way to fix?

Post by mhulse »

GeeMack wrote: I think both of your "-border" operations should come immediately after creating each label. It might work the way you have it, but normally you'd want to put that border around something that already exists. A version update, adding other operations to the label, or migrating to IM7 could possibly break your code the way you have it.
Ah, great catch! I moved the -border operation to after the label and it works exactly the same. Thank you for the tip(s), I greatly appreciate it!!!!

Have an awesome weekend GeeMack!
Homebrew-installed ImageMagick 7.0.8-27 Q16 x86_64 2019-02-12 | macOS Mojave | MacBook Pro
Post Reply