Image magick: right alignment in area

I am struggling with this: I am creating a tabular image. Everything is going well, but I can’t get it to work: I want to put some text in x, y: 10,10, but I want to align it in the 40x40 area. What for? because these are numbers. When I draw text, it is normal to place it at 10.10; it will default to 10.10 and therefore will be left aligned. But I have some numbers that I want to "right justify." The next “column” starts at position X 55, so I want to reserve some imaginary area from x = 10 to x = 50 (to preserve some margin in the next column) and draw the text from right to left at 10, 50.

I found the geometry parameter and region, but my trial version and errors did not give me good results.

Michelle

+3
source share
1 answer

-gravitycheck the documentation with examples .

Update : OK. I misunderstood the task.

But IMHO, you can still create your numbers as an image (of course, you can customize the font, etc.) and crop it:

/usr/bin/convert -fill black -size 40x40 label:$NUMBERS -transparent white -trim  numbers.gif

Now check the size of the new image

/usr/bin/identify trimmed.gif

Then figure out where to place it on your image. I leave it to you -)

Now you only need to combine the numbers with your image in the ideal position (replace + X + Y).

/usr/bin/composite -geometry +X+Y trimmed.gif original_image.jpg original_with_numbers.jpg

NTN

+7
source

Source: https://habr.com/ru/post/1718159/


All Articles