0

how can I add some text "before" an existing image using imagemagick? That means I have an image (a signature) and I would like to add some text (the current date) before the image, on the left side (not above or bottom). How can I do that? Ive tried it with append, but that havent worked for me :-(

Here is one exemple signature

And here it is how it should looks afterwards with the current date

Ive tried it with this code so far:

convert signature.png label:21.10.2019 -gravity West +append signature-with-date.png

Now Ive tried it with other order:

convert -gravity west label:21.10.2019 signature.png +append signature-with-date.png

But there is only white space before the image added, no text is shown

Ive tried it now with:

magick \( -size 400x -background white -gravity west label:21.10.2019 \) signature.png +append signature-with-date.png

Still not working

as you can see here

14
  • 1
    Please show the image you started with and how it is supposed to look afterwards - also, according to StackOverflow rules, you are supposed to show the code you have tried. Commented Oct 21, 2019 at 15:40
  • Hi Mark, Ive added two exemple images (before & afterwards) and also my code. Commented Oct 21, 2019 at 16:13
  • Change the order... convert -gravity west label:21.10.2019 signature.png +append signature-with-date.png Commented Oct 21, 2019 at 16:19
  • Or load in the same order but swap before appending... convert signature.png label:21.10.2019 -gravity West +swap +append signature-with-date.png Commented Oct 21, 2019 at 16:20
  • Ive tried it, but there is no text, only white space was added on the left side. :-/ Commented Oct 21, 2019 at 16:26

1 Answer 1

1

This works just fine for me on Imagemagick 6.9.10.68 Q16 Mac OSX.

Unix syntax:

convert \( -size 400x -background white -gravity west label:"21.10.2019" \) signature.png +append signature-with-date.png


Windows syntax:

convert ( -size 400x -background white -gravity west label:"21.10.2019" ) signature.png +append signature-with-date.png


enter image description here

What is your Imagemagick version and platform?

If on Imagemagick 7, use magick in place of convert.

Sign up to request clarification or add additional context in comments.

15 Comments

Not sure why you have included the parentheses here? Normally I would only do that to make sure an operator doesn't get applied to some secondary image I don't want it to affect, but as you only have a single image loaded, I would have thought they were unnecessary?
I dont know why, but it doesnt work out for me :-( (tested with both magick and convert) I have posted the result in my question, please take a look there. my version is ImageMagick 7.0.8-68, OS: ‪CentOS Linux 7.7.1908 (Core)‬
Add a specific font to your command and see if that works. Perhaps your OS does not have a defined default font. convert \( -size 400x -background white -gravity west -font arial label:"21.10.2019" \) signature.png +append signature-with-date.png. If that does not work. Use the path to some font that you have on your system. What do you get from magick -version for you delegates? Does it include freetype and fontconfig? If not, add them and recompile.
Here is the result of -magick version: Version: ImageMagick 7.0.8-68 Q16 x86_64 2019-10-07 imagemagick.org Copyright: © 1999-2019 ImageMagick Studio LLC License: imagemagick.org/script/license.php Features: Cipher DPC HDRI Modules OpenMP(3.1) Delegates (built-in): bzlib cairo djvu fftw fontconfig freetype gslib gvc heic jbig jng jp2 jpeg lcms ltdl lzma openexr pangocairo png ps raqm raw rsvg tiff webp wmf x xml zlib
Tried it with magick \( -size 400x -background white -gravity west -font Helvetica label:"21.10.2019" \) signature.png +append signature-with-date.png no other result than the one if posted above, no text.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.