Page 1 of 1

WMF image conversion.

Posted: 2012-01-23T07:17:37-07:00
by Keerthi
Hi All,
I have just started using imagemagick through im4java interface and found it very handy to deal with unconventional image fromats like EMF. I have a requirement to convert WMF image to a conventional format say, JPEG. I was able to convert an EMF image with the following piece of code.

String myPath="D:/ImageMagik/ImageMagick-6.7.4-7-Q16-windows/ImageMagick-6.7.4-7";
ProcessStarter.setGlobalSearchPath(myPath);

String imPath="D:/ImageMagik/ImageMagick-6.7.4-7-Q16-windows/ImageMagick-6.7.4-7";
ConvertCmd cmd = new ConvertCmd();
cmd.setSearchPath(imPath);

IMOperation op = new IMOperation();
op.addImage("D:/GK/test/image1.emf");
op.transform();
op.addImage("D:/GK/test/image_converted.jpg");
cmd.run(op);


But when i tried to convert a WMF image the same way, its throwing the following error.

Exception in thread "main" org.im4java.core.CommandException: org.im4java.core.CommandException: convert.exe: `%s' (%d) "gswin32c.exe" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -g283x14 "-sOutputFile=C:/DOCUME~1/keerthi/LOCALS~1/Temp/magick-GdiH-XDQ--0000001" "-fC:/DOCUME~1/keerthi/LOCALS~1/Temp/magick-k342rrVJ" "-fC:/DOCUME~1/keerthi/LOCALS~1/Temp/magick-JQdFzFNt" @ error/utility.c/SystemCommand/1895.
at org.im4java.core.ImageCommand.run(ImageCommand.java:215)
at util.ImageMagickUtil.main(ImageMagickUtil.java:33)
Caused by: org.im4java.core.CommandException: convert.exe: `%s' (%d) "gswin32c.exe" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -g283x14 "-sOutputFile=C:/DOCUME~1/keerthi/LOCALS~1/Temp/magick-GdiH-XDQ--0000001" "-fC:/DOCUME~1/keerthi/LOCALS~1/Temp/magick-k342rrVJ" "-fC:/DOCUME~1/keerthi/LOCALS~1/Temp/magick-JQdFzFNt" @ error/utility.c/SystemCommand/1895.
at org.im4java.core.ImageCommand.finished(ImageCommand.java:249)
at org.im4java.process.ProcessStarter.run(ProcessStarter.java:314)
at org.im4java.core.ImageCommand.run(ImageCommand.java:211)
... 1 more


Am i missing something here which is in specific to deal with WMF format. Appreciate ur help.

Thanks in advance.
Keerthi