Page 1 of 1
Image border size calculated from image size
Posted: 2019-05-30T11:51:56-07:00
by pnowak
Some parameters calculated. But something is wrong:
OS Windows 7 pro.
ImageMagick 7.0.8Q16
Constant parameters (first -annotate) work:
Code: Select all
convert %1 -bordercolor Black -border 64x64 -font Gadugi -pointsize 36 -fill white -gravity southwest -annotate 0x0+64+10 "%%[EXIF:ImageDescription]" -gravity southeast -annotate 0x0+64+10 "TEXT" %1b.jpg"
Calculated parameters (first -annotate) don't work:
Code: Select all
convert %1 -bordercolor Black -border 64x64 -font Gadugi -pointsize 36 -fill white -gravity southwest -annotate "0x0+%%[fx:min(h,w)/50]+10" "%%[EXIF:ImageDescription]" -gravity southeast -annotate 0x0+64+10 "TEXT" %1b.jpg"
Re: Image border size calculated from image size
Posted: 2019-05-30T11:54:29-07:00
by fmw42
What happens? Can you show the two results? You can upload to some free hosting service and put the URLs here.
What is your exact IM 7 version (7.x.x.x)?
Re: Image border size calculated from image size
Posted: 2019-05-30T12:02:22-07:00
by snibgo
pnowak wrote:Calculated parameters (first -annotate) don't work: ...
Use "magick" instead of "convert".
Re: Image border size calculated from image size
Posted: 2019-05-30T12:10:34-07:00
by pnowak
version 7.0.8-Q16
I need to calculate some parameters from size of image. But imageMAgick documentation seems very poor to me. I'm not able to find: how to calculate, where get image size, etc.... So I try some examples but without success.
"-border 0x0+64+10" works.
I need to calculate "min(imageHeight,imageWidth)/50" instead of 64.
is it right?
-border "0x0+%%[fx:min(h,w)/50]+10"
It returns eror:
convert: invalid argument for option '-border': %[fx:w/50]x64 @ error/convert.c/ConvertImageCommand/839.
Re: Image border size calculated from image size
Posted: 2019-05-30T12:27:18-07:00
by snibgo
As I said: Use "magick" instead of "convert".
Re: Image border size calculated from image size
Posted: 2019-05-30T12:34:25-07:00
by pnowak
@snibgo:
really? That way?
"C:\Program Files\ImageMagick-7.0.8-Q16\magick.exe" magick %1 -bordercolor Black -border 50%x50% -font Gadugi -pointsize 36 -fill white -gravity southwest -annotate 0x0+64+10 "%%[EXIF:ImageDescription]" -gravity southeast -annotate 0x0+64+10 "TEXT" %1b.jpg"
Re: Image border size calculated from image size
Posted: 2019-05-30T13:28:51-07:00
by snibgo
pnowak wrote:"C:\Program Files\ImageMagick-7.0.8-Q16\magick.exe" magick %1 ...
No. I said: Use "magick" instead of "convert". You have "magick" twice. And you've removed "%[fx...]" from your "-border" and "-annotate".
Re: Image border size calculated from image size
Posted: 2019-05-30T16:26:45-07:00
by fmw42
Most inline computations do not work in ImageMagick 6 (with convert). But they do work in ImageMagick 7 (with magick replacing convert).
Re: Image border size calculated from image size
Posted: 2019-05-30T21:23:05-07:00
by pnowak
@snibgo + fmw42: Perfect. It works now. Thanks !!!