in reply to random ImageMagick questions
If you want to clip the text to a given area, you may want to (1) create a new separate image of just the writable area, write your text in that, then apply it to the larger image, or (2) draw the text before you draw the other elements, so that the other elements overwrite any stray parts of the text.
Determining the extent (the bounding box) of the written text (before or after drawing) can be tricky, but I think Perl::Magick offers some routines to determine that.
Deciding how to alter your text to fit within a given space is far more tricky, and is usually an iterative process that is almost like trial and error. You have to decide what can be altered: font size, word wrapping, word breaking, etc. There will always be some strings that just can't fit: supercalifragilisticexpialidocious won't fit in a 128x128 icon and remain legible.
--
[ e d @ h a l l e y . c c ]
|
|---|