Page 1 of 1

How to add filename/demensions as caption like this?

Posted: 2020-02-25T00:35:27-07:00
by jessec116
Hi,

Here is the thing. I'm using Windows 10, ImageMagick-7.0.9-Q16. And I have a problem about adding labels to the pictures.

I want to edit mine like this.
Image

How can i write the code in the right way? And I have many pictures like that. And i want every each of them could be like the example picture. Is there a way(code) to automatically generate all thumbs? And then merge all thumbs in one big file?

Example:
my original picture's filename is A.jpg
Resolution is 3470x5206
Original size is 2.66MB

Re: How to add filename/demensions as caption like this?

Posted: 2020-02-25T00:42:38-07:00
by jessec116
I'm totally new to the IM. Thanks to all the experts first.

Re: How to add filename/demensions as caption like this?

Posted: 2020-02-25T00:55:28-07:00
by snibgo
I can't see your image. It seems to have no protocol, eg "http:" or "https:"

Re: How to add filename/demensions as caption like this?

Posted: 2020-02-25T01:14:03-07:00
by jessec116
snibgo wrote:
2020-02-25T00:55:28-07:00
I can't see your image. It seems to have no protocol, eg "http:" or "https:"
How about now?

Re: How to add filename/demensions as caption like this?

Posted: 2020-02-25T02:29:24-07:00
by snibgo
Your URL is:
http://pic.images.ac.cn/image/5e54cd04ac3d7

I get:
500 Internal Server Error

Re: How to add filename/demensions as caption like this?

Posted: 2020-02-25T02:54:36-07:00
by jessec116
snibgo wrote:
2020-02-25T02:29:24-07:00
Your URL is:
http://pic.images.ac.cn/image/5e54cd04ac3d7

I get:
500 Internal Server Error
Image
What about now?

Re: How to add filename/demensions as caption like this?

Posted: 2020-02-25T03:45:56-07:00
by snibgo
Okay, I can see that. If you simply want to append text to the bottom of your image:

Code: Select all

magick toes.png ^
  ( +clone ^
    -fill #0af -colorize 100 ^
    -fill Black -gravity North -pointsize 25 ^
    -annotate 0 "Hello world\nanother line\nthird line" ^
    -trim ^
  ) ^
  -background #0af -append +repage ^
  out.png
Image
I chose a light blue background, "#0af". You could use white or whatever.

Re: How to add filename/demensions as caption like this?

Posted: 2020-02-25T04:00:26-07:00
by jessec116
snibgo wrote:
2020-02-25T03:45:56-07:00
Okay, I can see that. If you simply want to append text to the bottom of your image:

Code: Select all

magick toes.png ^
  ( +clone ^
    -fill #0af -colorize 100 ^
    -fill Black -gravity North -pointsize 25 ^
    -annotate 0 "Hello world\nanother line\nthird line" ^
    -trim ^
  ) ^
  -background #0af -append +repage ^
  out.png
Image
I chose a light blue background, "#0af". You could use white or whatever.
Thanks but if i want to add filename(including suffix) & dimensions(orignal resolution/size, before any resizes and display with MBs) to the bottom of my image, what can i do? I know a little about %f, %G, %b etc. But I cant really get how to write them correctly.

Re: How to add filename/demensions as caption like this?

Posted: 2020-02-25T04:13:40-07:00
by snibgo
Escapes %w %h and so on are listed at https://www.imagemagick.org/script/escape.php

Just insert them within the annotation string, wherever you want them, eg:

Code: Select all

-annotate 0 "Hello %f world\nanother line %w x %h\nthird line"
Note that "\n" means a new line.

If you do this in a BAT script, double the percent signs: %%.