1

I am trying to add a watermark outside the image, creating firstly a padding place.

  • a) How can I do that? My imagemagick command have problem. Do not cover all my image files eg. "DSC_5568 - DSC_5588_fused.jpg" did not add padding.
  • b) I can combine the two separate commands?
  • c) I want to do that in bulk

My imagemagick commands:

for pic in DSC*.*; do convert -background black -extent 0%x0%+0+100 $pic ${pic//.*}-padded.jpg; done

for pic in DSC*padded.*;  do composite -dissolve 100% -gravity SouthEast watermark.png $pic ${pic//.*}-marked.jpg; done

example filenames:

"DSC_5568.JPG, DSC_5568 - DSC_5588_fused.jpg.... etc."

Estatistics
  • 874
  • 9
  • 24

2 Answers2

3

You really should provide sample input and expected output images, but I think you want this:

convert INPUT.JPG -background black -extent 0%x0%+0+100 -gravity southeast watermark.png -compose dissolve -composite RESULT.JPG

You may need to add this -define:

... watermark.png -define compose:args=100 -compose dissolve -composite ...

If that works, I would make a COPY of all your files in a spare directory and do the whole lot in parallel with GNU Parallel:

parallel 'convert {} -background black -extent 0%x0%+0+100 -gravity southeast watermark.png -compose dissolve -composite {.}-marked.jpg' ::: *.jpg

Or, if you prefer a simple bash for loop:

for f in DSC* ; do
   convert "$f" -background black -extent 0%x0%+0+100 -gravity southeast watermark.png -compose dissolve -composite "${f//.*}-marked.jpg"
done
Mark Setchell
  • 191,897
  • 31
  • 273
  • 432
  • If it doesn't work, please say what went wrong and click `edit` under your original question and add input and expected output images. Thank you. – Mark Setchell Jul 04 '20 at 14:02
0

I found out how to process all my image files, using "" on the specified filenames.

for pic in DSC*.*; do convert -background black -extent 0%x0%+0+100 "$pic" "${pic//.*}-padded.jpg"; done

for pic in DSC*-padded.*;  do composite -dissolve 100% -gravity SouthEast watermark.png "$pic" "${pic//.*}-marked.jpg"; done
Estatistics
  • 874
  • 9
  • 24