2 lines of vertical 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
richardsky
Posts: 1
Joined: 2014-09-24T05:34:10-07:00
Authentication code: 6789

2 lines of vertical text

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: 2 lines of vertical text

Post 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
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: 2 lines of vertical text

Post 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");
Post Reply