Results 1 to 10 of 11
G'day Everyone,
It's been a while since I've posted here but I've run into a problem that no amount of Googling will resolve.
I'm using Image Magick to add a ...
- 09-27-2011 #1Just Joined!
- Join Date
- Jan 2010
- Location
- Sydney, Australia
- Posts
- 51
imagemagick from bash script...
G'day Everyone,
It's been a while since I've posted here but I've run into a problem that no amount of Googling will resolve.
I'm using Image Magick to add a footer into JPG files and running this from the command line works every time without error however when I copy this into a bash script I get an error:
convert: option requires an argument `-annotate' @ error/convert.c/ConvertImageCommand/660.
inside bash script:Code:convert /mnt/sdcard/testimage.jpg -gravity South -chop 0x38 background black -fill white -splice 0x37 -pointsize 32 -annotate +0+2 test
Does anyone have any ideas?Code:#!/bin/bash convert /mnt/sdcard/testimage.jpg -gravity South -chop 0x38 background black -fill white -splice 0x37 -pointsize 32 -annotate +0+2 test
Last edited by r31griffo; 09-27-2011 at 01:13 PM. Reason: typo
- 09-27-2011 #2Just Joined!
- Join Date
- Jan 2010
- Location
- Sydney, Australia
- Posts
- 51
I'm not sure if it will help diagnose the problem, but I'm running Debian Lenny with Dash shell (tried Bash but no change)
- 09-27-2011 #3Linux Guru
- Join Date
- May 2011
- Posts
- 1,788
At first glance...
Don't you need a filename at the end?
Don't you need a missing '-' before the background option?
e.g.:
Code:convert /mnt/sdcard/testimage.jpg -gravity South -chop 0x38 -background black -fill white -splice 0x37 -pointsize 32 -annotate +0+2 test /tmp/testimage2.jpg
- 09-27-2011 #4Just Joined!
- Join Date
- Jan 2010
- Location
- Sydney, Australia
- Posts
- 51
are the requirements different inside a script than outside? This works if not used inside the script.
As far as I'm aware, becase the file is ammended (not appended) it only needs to be done at the start of the command...Please let me know if this is not accurate.
I'm not sure I get you...from what I see in my example there is a hyphen in it...do I need another before the colour? or do you mean a double - before background?.
In the example given, this is to ammend a file, not append a file and from what I understand (I might be wrong, please tell me if I am) the ammended file only needs to be listed at the start of the command.
I'm open to any ideas, please let me know and thank you for reading the response.
- 09-27-2011 #5Linux Guru
- Join Date
- May 2011
- Posts
- 1,788
I guess we've got substantially different versions of ImageMagick (mine reports 6.0.7). The command as you posted it did not work on my system without an output filename, and it also complained about the background switch without a hyphen (your posted example does not show a hyphen before background on my computer anyway...). And no, it shouldn't be different whether called on the command line or via script - that is indeed weird.
EDIT: do you have multiple versions of ImageMagick installed? maybe the script finds one version, and is found in another path when run in the shell...Last edited by atreyu; 09-27-2011 at 03:07 PM. Reason: multiple versions?
- 09-27-2011 #6Just Joined!
- Join Date
- Jan 2010
- Location
- Sydney, Australia
- Posts
- 51
atreyu,
I just noticed your reply goes to /tmp ... I just realised I was writing this to NAND, not RAM. Thank you for demonstrating this to me...otherwise I could of had an issue in a couple of years time and not known why
- 09-27-2011 #7Just Joined!
- Join Date
- Jan 2010
- Location
- Sydney, Australia
- Posts
- 51
I'm running ImageMagick 6.6.0-4 (from Debian Squeeze repository), as far as I know there is only 1 version of it installed...I can only find 1 convert binary located at: /usr/bin/convert
I'm not sure what you mean about the background switch missing a hyphen, there is one there.
I've tried the example you posted from the command line and I got "test /tmp/testimage2.jpg" as the footer (without the quotation marks of course
)
Do you know of another way to ammend a picture with a footer? All examples on the web append the picture, the result is multiple footers if the command is run more than once...It took me a couple of hours to figure this one out.
- 09-28-2011 #8Just Joined!
- Join Date
- Jan 2011
- Location
- Fairfax, Virginia, USA
- Posts
- 94
r31griffo,
I tried your example and I was able to reproduce your problem exactly. I managed to fix up the command and realized I did what Atreyu suggested. I'm pretty sure his suggestion works.
- 09-28-2011 #9Just Joined!
- Join Date
- Jul 2010
- Location
- New Mexico, USA
- Posts
- 29
I agree with atreyu regarding the hyphen missing preceding "background" in the original posting.
- 09-28-2011 #10Just Joined!
- Join Date
- Jan 2010
- Location
- Sydney, Australia
- Posts
- 51
Please accept my apologies, Atreyu was correct all along.
There was a hyphen missing and putting the new filename after the text fixed all my problems...
I had been working on this problem for so long and I was so tired that I don't think I was thinking straight anymore. When I looked at it again tonight with fresh eyes, Atreyu's post made a lot more sense to me.
Anyway, thank you everyone who posted here I really do appreciate the help.
Cheers,
Griffo


Reply With Quote

