Page 1 of 1

label crops the top of some unicode letter

Posted: 2019-07-29T15:47:10-07:00
by siolag
I tried to generate some images of unicode text using label and they looks good when the size of the image is provided in full using -size. However, when -size is missing, or only the height is specified, some letters miss parts of their top. For example:

convert -background none -size 200x100 -font Georgia -pointsize 72 -gravity center -fill black label:"THỎ" o2.png
Image

convert -background white -size x100 -font Georgia -pointsize 72 -gravity center -fill black label:"THỎ" o1.png
Image

convert -background white -font Georgia -pointsize 72 -gravity center -fill black label:"THỎ" o.png
Image

For my purpose, I can't actually set the size because I want to ultimately create the images of each letter with a different color and combine them together (using +append).

Is there a work around for this?

My imagemagick version:

Code: Select all

convert -version
Version: ImageMagick 7.0.8-53 Q16 x86_64 2019-07-09 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC HDRI Modules OpenMP(3.1)
Delegates (built-in): bzlib freetype heic jng jp2 jpeg lcms ltdl lzma openexr png tiff webp xml zlib

Re: label crops the top of some unicode letter

Posted: 2019-07-29T16:41:47-07:00
by snibgo
You could prefix the label text with "\n":

Code: Select all

convert ... label:"\nTHỎ" o.png

Re: label crops the top of some unicode letter

Posted: 2019-07-29T17:06:33-07:00
by siolag
Nice trick and it works! Thanks!