How to print text vertically

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

-annotate -90x-90 'text'

will draw the text vertically. Or you can create a label: or caption:
then -rotate -90 to make the text vertical.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

Oh... Well try adding a newline escape between letters!

convert -pointsize 48 label:'A\nB\nC\nD\nE' vertical.png
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

First, I am not a PHP IM user. so I can't give you direct PHP source. Second we are not going to do all the work for you. It will be up to you to figure out exactly what you want and code it in PHP. Geting it working on the command line will let you fintune things first, then you can encode each operation into the PHP API, or have the PHP call IM commands (though that has its own set of problems).

The basic solution is to crate a label of the vertically appended text in the color wanted, on a transparency canvas, then overlay it with a 'East' gravity setting.

Drawing the text on a transparent canvas in this way is the most versitile as you can further modify the text before overlaying it in lots of ways. See Compound Font Effects for suggestions and examples... http://www.cit.gu.edu.au/~anthony/graph ... ck6/fonts/

I am sorry I can't be more help. perhaps others will be willing. I myself am getting ready to do on a european vacation for the whole of April, so I will not be around much after this next week.

If you use -annotate instead of label: you can draw the text more directly with extra controls like outline stroking. However you may have to do this on a larger transparent canvas then trim it down before overlaying.

For lots of examples of converting text to images see http://www.cit.gu.edu.au/~anthony/graph ... ick6/text/
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply