Page 1 of 1
Why can't I add text into a JPEG file?
Posted: 2007-07-16T01:58:48-07:00
by engtia
C:\im>convert -draw 'text "test"' winter.jpg winter8.jpg
convert: unable to open image `test'': No such file or directory.
convert: Non-conforming drawing primitive definition `text'.
Hi guys, just started in IM. Hit some stopper. I think this is rather simple but I am unable to solve it. I am merely trying to add text(which is "test") into the image. I am running in windows xp. Help me please! Thanks a milliion!
Tung
Re: Why can't I add text into a JPEG file?
Posted: 2007-07-16T04:12:10-07:00
by vikrammandal
This worked for me
mogrify -pointsize 20 -draw "fill red text 10,10 'my text' " winter.jpg
Re: Why can't I add text into a JPEG file?
Posted: 2007-07-16T08:38:49-07:00
by el_supremo
There are three problems with your command.
First, the quotes are tripping you up. Windows does not like the single quote. Use double quotes as the outermost pair on a string, like this: "text 'test'"
Note that the string ends with a single quote and then a double quote.
Second, as an argument to the text subcommand, you have to specify a coordinate where the text will be placed. e.g. "text 10,10 'test'"
Third, you must read the image in first before you try to draw on it. So, the whole command should be:
Code: Select all
convert winter.jpg -draw "text 10,10 'test'" winter8.jpg
[EDIT] vikrammandal's example of the mogrify command will work but it overwrites the winter.jpg input image. This is fine if that's what you want to do, but otherwise you should use the convert command to produce a different output file.
Pete
Re: Why can't I add text into a JPEG file?
Posted: 2007-07-16T08:54:37-07:00
by engtia
thank you so much for the prompt reply. I wonder why convert don't work?
Re: Why can't I add text into a JPEG file?
Posted: 2007-07-16T09:11:02-07:00
by engtia
Thanks Vikrammandal and Pete! Your solve my problem nicely. Now I know both methods. I must have been referred to a sample meant for Unix. The quotes used are different. Thanks!