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
Why can't I add text into a JPEG file?
Re: Why can't I add text into a JPEG file?
This worked for me
mogrify -pointsize 20 -draw "fill red text 10,10 'my text' " winter.jpg
mogrify -pointsize 20 -draw "fill red text 10,10 'my text' " winter.jpg
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: Why can't I add text into a JPEG file?
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:
[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
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
Pete
Re: Why can't I add text into a JPEG file?
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?
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!