Page 2 of 2

Re: create text shadow

Posted: 2017-02-07T19:41:31-07:00
by fmw42
Have you tried to adapt it to your example code? If you have and cannot figure it out, then post your original sunrise-sea.jpg so I have something to work against your code.

Also adding shadow to a small pointsize and black text is not going to be very impressive. You need some contrast between the font color and the shadow and a larger font size to be effective.

Re: create text shadow

Posted: 2017-02-07T23:46:02-07:00
by kholidfu
Here is my sunrise-sea.jpg
Image

Here are what I want to do:

Using sunrise-sea.jpg, I want:
1. create a rectangular box with size 500x200 (box1)
2. put a text inside that box1, the point is font will be larger/smaller automatically according to nums of characters.
3. create a rectangular box (box2)

with this command I can accomplish that:

Code: Select all

convert sunrise-sea.jpg \
-size 500x200! -font Ubuntu-Bold-Italic -background none \
label:"The only thing that interferes with my learning is my education.\nALBERT EINSTEIN" \
-geometry +50+180 -composite -fill none -strokewidth 2. \
-stroke black -draw "rectangle 20, 20, 580, 380" \
test.png
result:
Image

then I want to make the text shadowed

Using your command, I can only achieved this:

Code: Select all

convert sunrise-sea.jpg \
-size 500x200! \
\( -background none -font arial -pointsize 48 \
-fill black label:"The only thing that interferes with my learning is my education.\nALBERT EINSTEIN" -trim +repage \) \
\( -clone 1 -background blue -shadow 80x3+5+5 \) \
\( -clone 1 -clone 2 +swap -background none -layers merge +repage \) \
-delete 1,2 \
-stroke black -draw "rectangle 20, 20, 580, 380" \
-compose over -composite \
result.png
and the result:
Image

Thank you...

Re: create text shadow

Posted: 2017-02-08T00:41:30-07:00
by fmw42
Try this:

Code: Select all

convert yMaXdfL.jpg \
\( -size 500x200! -background none -gravity center -font arial \
	-fill white \
	label:"The only thing that interferes with my learning is my education.\nALBERT EINSTEIN" \
	-trim +repage \) \
\( -clone 1 -background black -shadow 80x3+5+5 \) \
\( -clone 1 -clone 2 +swap -background none -layers merge +repage \) \
-delete 1,2 \
-gravity center -compose over -composite \
-fill none -stroke black -draw "rectangle 20, 20, 580, 380" -alpha off \
result.png
Change the -fill white in the third line if you want black text rather than white.

Sorry I do not have your exact font, but you can change arial to your font name or to the path to your font file.

Re: create text shadow

Posted: 2017-02-08T06:35:10-07:00
by kholidfu
I don't want the -gravity center param, I need to place the text manually inside 500x200! box

Code: Select all

-geometry +50+180 -composite -fill none -strokewidth 2. \

Re: create text shadow

Posted: 2017-02-08T10:45:26-07:00
by fmw42
Simple enough to change.

Code: Select all

convert yMaXdfL.jpg \
\( -size 500x200! -background none -gravity center -font arial \
-fill white \
label:"The only thing that interferes with my learning is my education.\nALBERT EINSTEIN" \
-trim +repage \) \
\( -clone 1 -background black -shadow 80x3+5+5 \) \
\( -clone 1 -clone 2 +swap -background none -layers merge +repage \) \
-delete 1,2 \
+gravity -geometry +50+180 -compose over -composite \
-fill none -stroke black -strokewidth 2 -draw "rectangle 20, 20, 580, 380" -alpha off \
result.png

Re: create text shadow

Posted: 2017-02-08T15:58:10-07:00
by kholidfu
If I have longer text like below, it becomes unreadable...

Code: Select all

convert yMaXdfL.jpg \
\( -size 500x200! -background black -gravity center -font arial \
-fill white \
label:"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, The only thing that interferes with my learning is my education.\nALBERT EINSTEIN" \
-trim +repage \) \
\( -clone 1 -background black -shadow 80x3+5+5 \) \
\( -clone 1 -clone 2 +swap -background none -layers merge +repage \) \
-delete 1,2 \
+gravity -geometry +50+180 -compose over -composite \
-fill none -stroke black -strokewidth 2 -draw "rectangle 20, 20, 580, 380" -alpha off \
result.png
result:
Image

any idea on how to make text auto shrink/expand according to sum of characters? or any better idea?

Thank you

Re: create text shadow

Posted: 2017-02-08T18:45:06-07:00
by fmw42
You may need to use caption: and a pointsize with only -size Wx to define the width to keep larger type. The label: command is going to shrink the text to fit one line as wide as you specified in -size WxH. You also change the background of the text to black and the shadow won't show well that way. Try this and adjust the pointsize as desired.

Code: Select all

convert yMaXdfL.jpg \
\( -size 500x -background none -gravity center -font arial -pointsize 18 \
-fill white \
caption:"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, The only thing that interferes with my learning is my education.\nALBERT EINSTEIN" \
-trim +repage \) \
\( -clone 1 -background black -shadow 80x3+5+5 \) \
\( -clone 1 -clone 2 +swap -background none -layers merge +repage \) \
-delete 1,2 \
+gravity -geometry +50+180 -compose over -composite \
-fill none -stroke black -strokewidth 2 -draw "rectangle 20, 20, 580, 380" -alpha off \
result.png


Re: create text shadow

Posted: 2017-02-09T03:15:03-07:00
by kholidfu
Additional questions...

How to create 2 text with different font setting, in my command example, "Indonesia" below "America".
Both need shadowed too.

Here is what I'm tryin' and failed...

Code: Select all

convert yMaXdfL.jpg \
\( -size 500x -background none -font Courier10PitchB -pointsize 30 -fill white \
 caption:"America." -trim +repage \) \
\( -size 500x -background none -font Arial -pointsize 30 -fill white \
 caption:"Indonesia." -trim +repage \) \
\( -clone 1 -background black -shadow 80x3+5+5 \) \
\( -clone 1 -clone 2 +swap -background none -layers merge +repage \) \
-delete 1,2 -gravity center -compose over -composite -fill none \
-stroke black -strokewidth 2 -alpha off result.png
Thank you...