Newsgroups: gmane.comp.video.image-magick.user Date: Mon, 25 Jun 2007
| I use the "-shade" operator to create beveled fonts. Ref: | http://www.imagemagick.org/Usage/fonts/#bevel[] | | The problem is that I need the text to be on 2 lines, but the line spacing | is too wide for me, since my image is small: | http://xpt.sourceforge.net/images/xpt.gif[] | | I'm wondering if there is any way to reduce the line spacing in this case?
Two ways. Do the two words separatally trim and center append.
or somehow chop out the unwanted 'gap'. Look for the divide_vert script in http://www.imagemagick.org/Usage/scripts/ in a day or so. I just re-wrote it to not use so many temporary files, and speed it up.
PS: I'l like to see that added to MagickCore library. :-)
Anthony Thyssen
| > The problem is that I need the text to be on 2 lines, but the line spacing | > is too wide for me, since my image is small: | | Forgot to say, this is how I did it: | | convert -size 220x25 xc:black -font Candice -pointsize 14 -fill white \ | -gravity center -annotate 0 'line1\nline2' -shade \ | 140x60 xpt.gif | | Candice is a symlink to a ttf font file.
Why? define it properly in IM… See the top level IM example page. http://www.imagemagick.org/Usage/#font
You can then add all your fonts into IM with nice names.
| The result is at, | | > http://xpt.sourceforge.net/images/xpt.gif[] | > | > I'm wondering if there is any way to reduce the line spacing in this | > case?
The pointsize of a font represents its line spaceing. that is its actual defination!!!!
It is then up to the font designers on how you want to fill that space. And most of them do a horrible job of using that space!
But I knwo what you want. If you are always using the same font and pointsize, you can '-chop' out the extra space….
For example 5 rows of pixels from the 14th pixel form the top…
convert http://xpt.sourceforge.net/images/xpt.gif \ -chop 0x5+0+14 xpt_squeezed.gif
Alternatively in a couple of days a new script will be up in http://www.imagemagick.org/Usage/scripts/ called "divide-horiz" Which is a quick script I wrote on the weekend to solve a problem I was having. The script works, but does not check that each line also has the same color :-(
This divides an image into multiple images divided by lines of constant color. That is the 'gaps' in an image, That is images will become a list of images of the form
blanks, stuff, blanks, stuff,....
which if you -append would re-form the original image. Note if the image was 'trimmed' the first image would not be 'blank'.
You only need to remove or 'fix' the size of the blank 'gap' images.
I am wanting to get the funcationality of this script built into IM as a -divide-horiz option. Which along with a -layers RemoveBlank operation can be used to delete the blank images that are all one color.
Anthony Thyssen