ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Here's the screendump
onk@XEON4 ~/TEST/PIC/PIC $ ls *T*.*
T.jpg T.sh
onk@XEON4 ~/TEST/PIC/PIC $ echo $X $XX $Y $YY
30 178 15 55
onk@XEON4 ~/TEST/PIC/PIC $ convert T.jpg \(+clone -draw "rectangle '$X','$Y','$XX','$YY'" \) -composite conv-T.jpg
convert: unable to open image `(+clone': No such file or directory @ error/blob.c/OpenBlob/2712.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501.
convert: non-conforming drawing primitive definition `rectangle' @ error/draw.c/DrawImage/3190.
convert: unable to parse expression `)' @ error/convert.c/ConvertImageCommand/601.
Putting the actual values in and running your suggestion also does not work
onk@XEON4 ~/TEST/PIC/PIC $ convert T.jpg \(+clone -draw "rectangle 30,15,178,55" \) -composite conv-T.jpg
convert: unable to open image `(+clone': No such file or directory @ error/blob.c/OpenBlob/2712.
convert: no decode delegate for this image format `' @ error/constitute.c/ReadImage/501.
convert: unable to parse expression `)' @ error/convert.c/ConvertImageCommand/601.
This is what does work:
onk@XEON4 ~/TEST/PIC/PIC $ convert T.jpg \( +clone -draw 'rectangle 30,15,178,55' \) -composite conv-T.jpgjonk@XEON4 ~/TEST/PIC/PIC $
All I want to know is how to parameterise the rectangle co-ords in a bash script, it shouldn't be this hard surely?
So here's a script that does work and draws a black rectangle of a specified height and width with the top left hand corner at a specified distance from the top left hand corner of the image
Glad that you found help, and thanks to those who replied!
In future, please place your code and command snippets inside [CODE]...[/CODE] tags for better readability. You may type those yourself or click the "#" button in the edit controls.
Glad that you found help, and thanks to those who replied!
In future, please place your code and command snippets inside [CODE]...[/CODE] tags for better readability. You may type those yourself or click the "#" button in the edit controls.
Thanks!
Hi No problem, didn't spot that one!
From now on my code will look like
Code:
CODE=10
And of course you can post a bit of PHP code
PHP Code:
Very useful!
originally an acronym for Personal Home Pages - or is that an urban myth?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.