label crops the top of some unicode letter

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
siolag
Posts: 2
Joined: 2019-07-29T15:36:35-07:00
Authentication code: 1152

label crops the top of some unicode letter

Post 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
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: label crops the top of some unicode letter

Post by snibgo »

You could prefix the label text with "\n":

Code: Select all

convert ... label:"\nTHỎ" o.png
snibgo's IM pages: im.snibgo.com
siolag
Posts: 2
Joined: 2019-07-29T15:36:35-07:00
Authentication code: 1152

Re: label crops the top of some unicode letter

Post by siolag »

Nice trick and it works! Thanks!
Post Reply