Text rotation

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
knedl2007

Text rotation

Post by knedl2007 »

Hi,

i want to make a transparent png with a rotated text in it. My Code is as follows:

Code: Select all

convert ( -size 235x53 xc:none ) ( ( -size 250x50 xc:none ) ( -size 0x0 -background none -font journal.ttf -pointsize 23 -fill #111111 label:"Text Text Text" -rotate -5 ) -gravity center -composite )  -composite -depth 8 -quality 95 grouptext.png
But, whatever i try, when i rotate the text is blurred.
Without the -rotate argument, the text is sharp.

The Code above is a little bit complicated because I need the transparent canvas. Here is the essential extract:

Code: Select all

convert -background none -font journal.ttf -pointsize 23 -fill #111111 label:"Text Text Text" -rotate -5 -depth 8 -quality 95 grouptext.png
It is the same here, without the rotation it is fine, but with the rotation it is blured.

The effect is independent of the font.

thx, knedl
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Text rotation

Post by anthony »

Text is blured by rotation.

Two solutions. Rotate larger text, then shrink it using resize.
That works very very well.

the alturnative is to use -distort SRT
to do it. However this is still in development but does do a better job than the default -rotate. In the next month or so I will have gotten back to its development and it will do an even better job!

Operator can also do a lot more than just rotate text, it can perspetive, or even curve, circle the text or other images. I even hope to have it do lots more still.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
knedl2007

Re: Text rotation

Post by knedl2007 »

Thanks a lot!

nice, that it is not my fault ;) and the hack with resizing a larger text works really fine!
knedl2007

Re: Text rotation

Post by knedl2007 »

by the way: could it be that the phenomenon also appears with image rotation?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Text rotation

Post by anthony »

Yes. It is caused by -rotate being defined as 3 shearing operations (for speed, not that IM is fast in this respect), rather than as a reversed pixel mapping as it is in -distort.

You can see the bluring in the enlarged view of a -rotate line...
http://imagemagick.org/Usage/distorts/#rotate_line

Compare that to using a reversed pixel mapping (-distort)
http://imagemagick.org/Usage/misc/#interpolate_line

Note that -distort will only use interpolation pixel mapping (filtering) when no minification is needed. However this may change as I am just finishing up work on resize filters (re-writing the whole resize page actually)
http://imagemagick.org/Usage/resize/
and I will be able to get back to distortion improvements.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply