Re: Proportional watermark
Posted: 2017-02-04T08:21:10-07:00
I tried this variant. It takes a height of the watermark.png but I need to take a height of the input.png.
Use https://github.com/ImageMagick/ImageMagick/discussions instead.
https://imagemagick.com/discourse-server/
https://imagemagick.com/discourse-server/viewtopic.php?t=30890
Code: Select all
magick input.png -set option:wmh "%[fx:h/5]" ( watermark.png -resize x%[wmh] ) -gravity center -composite result.png
Code: Select all
magick input.png ( watermark.png -resize x%[fx:u[0].h/5] ) -gravity center -composite result.png
Code: Select all
magick input.png -set option:wmh "%[fx:h/5]" ( watermark.png -resize x%[wmh] ) -gravity center -composite result.png
Code: Select all
find a -type f -name "*.jpg" -print0 | xargs -0 -n1 -P8 -I {} magick {} -set option:wmh %[fx:w/2] ( mark2.png -sample %[wmh]x ) -gravity east -compose dissolve -define compose:args=60 -composite {}
I don't know much about the internals, but if there's something about setting and reading a variable that slows the command, you could try writing the FX calculation as an inline argument to the "-resize" operation. A command like this should give you the result you're looking for. You'll have to test it yourself for speed comparison.
Code: Select all
magick input.png watermark.png -resize "x%[fx:t?u[0].h/5:u[0].h]" -gravity center -composite result.png