Page 1 of 1

2 lines of vertical text

Posted: 2014-09-24T05:55:22-07:00
by richardsky
ImageMagick-6.3.4-Q8 Windows Command Line

Hi there,

Can anyone help me with a command to write two lines of vertical text? I have seen the command line code to write one line in the forum but wondered if two were possible. I am not experienced with IM command line language but i understand the concepts. The guy that wrote the routine we use has died. His sub routine for creating an image with horizontal text is:

begin
-size 787x576
-encoding unicode
xc:transparent
-font "C:\WINDOWS\Fonts\calibrib.ttf"
-gravity south
-pointsize 39
-fill rgb(245,245,180)
-stroke black
-strokewidth 5
-annotate 0x0+0+53 $T
-stroke none
-annotate 0x0+0+53 $T
$F
end
rem $T substitute for text file name
rem $F substitute for output path and filename
rem -encoding unicode for chinese fonts

I would like to have a routine that writes the two lines of text as vertical lines starting from the top right hand corner. I can tweak the exact positions, it is the generation of two lines of vertical text that i am not sure about - can anyone help?

Thanks,
Richard.

Re: 2 lines of vertical text

Posted: 2014-09-24T09:47:14-07:00
by fmw42
I do not think you can use -draw to do that except by drawing one character at a time. With label: you can insert line feed (\n) between each character in your text string and get something like http://www.imagemagick.org/Usage/text/#label_vertical

Re: 2 lines of vertical text

Posted: 2014-09-24T10:57:08-07:00
by Bonzo
I have a nice php method you may be able to convert to a batch file:

Code: Select all

$string="TEXT"; 
 for ($pos = 0; $pos < strlen($string); $pos++) 
 if ( $pos != strlen($string)-1 ){ 
    $modified .= substr($string, $pos, 1)."\\n"; } 
         
    else $modified .= substr($string, $pos, 1); 
         
exec("convert -pointsize 20 -gravity center label:$modified label_vertical1.gif");