Page 1 of 1

How give to imagemagick imagesize like parametr in bash?

Posted: 2017-07-01T03:37:59-07:00
by gyok
I trying create B.png which will have same size as A.png, and will be created by tiling pencil.png. What I do:

Code: Select all

#!/bin/bash
size=$(identify -format %wx%h $1)
convert -size ${size} tile:pencil.png pencil_ground.png
but magick give me error:

Code: Select all

convert: invalid argument for option `-size': tile:pencil.png @ error/convert.c/ConvertImageCommand/2753.
if I set my size of image all works:

Code: Select all

#!/bin/bash
size=$(identify -format %wx%h $1) 
convert -size 500x500 tile:pencil.png pencil_ground.png
So how give to convert command size of another image?

Re: How give to imagemagick imagesize like parametr in bash?

Posted: 2017-07-01T04:46:51-07:00
by snibgo
The error message suggests the value of ${size} is blank. What happens when you echo it? What happens when you start the script with:

Code: Select all

identify -format %wx%h $1
Does that output what you expect?