How give to imagemagick imagesize like parametr in bash?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
gyok
Posts: 1
Joined: 2017-07-01T03:29:12-07:00
Authentication code: 1151

How give to imagemagick imagesize like parametr in bash?

Post 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?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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?
snibgo's IM pages: im.snibgo.com
Post Reply