process builder in java, convert and escape chars pb

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
lewisstrauss

process builder in java, convert and escape chars pb

Post by lewisstrauss »

Hello everyone!
Here is my problem: from a java class i'm executing the convert command through the java process builder, but inserting chars like " or ' the convert command doesn't execute correctly.

-draw, text 260,146 'abc'

The command is transmitted to image magick that converts the text into an image :D. How can i convert the chars ", ' into an image also? because instead of converting them into image i get an image with formatted text depending on the char type (ex if i put " it just excludes them, if i put ' i can't see the string that follows that char).

Thanx in advance :p
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: process builder in java, convert and escape chars pb

Post by fmw42 »

lewisstrauss wrote:Hello everyone!
Here is my problem: from a java class i'm executing the convert command through the java process builder, but inserting chars like " or ' the convert command doesn't execute correctly.

-draw, text 260,146 'abc'

The command is transmitted to image magick that converts the text into an image :D. How can i convert the chars ", ' into an image also? because instead of converting them into image i get an image with formatted text depending on the char type (ex if i put " it just excludes them, if i put ' i can't see the string that follows that char).

Thanx in advance :p

I don't know much about java, but in command line IM, the syntax would be simply to show abc as the text as follows:

convert .... -draw "text 260,146 'abc'" ...

see http://www.imagemagick.org/Usage/draw/

If you want the quotes or other special characters to show in the string as well, then you need to escape them. The escape may depend upon windows or unix.

see http://www.imagemagick.org/Usage/draw/#text
Post Reply