Page 1 of 1

Convert CGM to jpg

Posted: 2011-03-22T03:33:54-07:00
by cuicui6669
Hi,

I want to use ImageMagick to convert *.cgm files to *.jpg .

My operating system is windows XP 32bit.

I have already installed ImageMagick 6.6.8 (downloaded from ImageMagick.org http://www.imagemagick.org/script/downl ... 0u01299vq6)

To convert those files, i follow this link http://www.imagemagick.org/script/formats.php. So, I have installed ralCGM 3.50 module (downloaded from ImageMagick.org http://www.imagemagick.org/download/delegates/)

I set the install directory of ralcgm.exe to my environement variable "PATH"
I also set the directory of ./ralcgm/data/ to a new environnement variable "CGMDATA"

So, i try this:
-

Code: Select all

convert C:\temp\sources\detail.cgm C:\temp\output\detail.jpg

Code: Select all

Magick: delegate failed `ralcgm -d ps "%i." "%o." "%u."' @ error/delegate.c/InvokeDelegate/1058.

That's the result:
Magick: `%s' (%d) "gswin32c.exe" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignTo
Pixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -g612x792  "-sOutputFile=C:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-JGapMa7M--0000001" "-fC:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-Z9AO9WeL" "-fC:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-xMv1KAxQ" @ error/utility.c/SystemCommand/2094.

Magick: `%s' (%d) "gswin32c.exe" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignTo
Pixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -g612x792  "-sOutputFile=C:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-JGapMa7M--0000001" "-fC:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-Z9AO9WeL" "-fC:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-xMv1KAxQ" -c showpage @ error/utility.c/SystemCommand/2094.

Magick: Postscript delegate failed `C:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-njow1c-a': No such file or directory @ error/ps.c
/ReadPSImage/806.

Magick: missing an image filename `C:\temp\output\detail.jpg' @ error/convert.c/ConvertImageCommand/2974.
Following this link: http://www.wizards-toolkit.org/discours ... =1&t=15989
I try this:

Code: Select all

ralcgm -d ps -oC  C:\temp\sources\detail.cgm C:\temp\output\detail.ps
That's the result:

Code: Select all

RAL CGM Interpreter Version 3.50

***FATAL ERROR: CGMibin [146] Wrong Version number
So ralcgm make the "detail.ps" file but it's corrupted...
I try this anyway:

Code: Select all

convert C:\temp\output\detail.ps C:\temp\output\detail.jpg
The result:

Code: Select all

Magick: `%s' (%d) "gswin32c.exe" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignTo
Pixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -g612x792  "-sOutputFile=C:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-fz6m42EV--0000001" "-fC:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-oUIyJyca" "-fC:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-BpVGtjZw" @ error/utility.c/SystemCommand/2094.

Magick: `%s' (%d) "gswin32c.exe" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignTo
Pixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -g612x792  "-sOutputFile=C:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-fz6m42EV--0000001" "-fC:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-oUIyJyca" "-fC:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-BpVGtjZw" -c showpage @ error/utility.c/SystemCommand/2094.

Magick: Postscript delegate failed `C:\temp\output\detail.ps': No such file or directory @ error/ps.c/ReadPSImage/806.

Magick: missing an image filename `C:\temp\output\detail.jpg' @ error/convert.c/ConvertImageCommand/2974.
I try the same with
Edit delegates.xml and change the CGM delegate to

<delegate decode="cgm" thread-support="False" command="ralcgm -d ps "%i." "%o." "%u.""/>
It doesn't work anyway .......

Can you help me please? Do you have a link which explain me how use ImageMagick to convert CGM files?

:)

Re: Convert CGM to jpg

Posted: 2011-03-23T13:10:20-07:00
by fmw42
did you reinstall IM after installing the cgm delegate?

Re: Convert CGM to jpg

Posted: 2011-03-24T08:35:54-07:00
by cuicui6669
Hi fmw42,

Thanks to try to help me :)

I did your advise.
So:
- I uninstall IM
- I install ralCGM
- I install IM (6.6.8 - Q16)

I get a new error:

Code: Select all

Magick: delegate failed `ralcgm -d ps "%i." "%o." "%u."' @ error/delegate.c/InvokeDelegate/1058.

Magick: `%s' (%d) "gswin32c.exe" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignTo
Pixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -g612x792  
"-sOutputFile=C:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-A9ezDV_R--0000001" 
"-fC:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick--rFjTHb1" 
"-fC:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-6jc38cAC" @ error/utility.c/SystemCommand/2094.

Magick: `%s' (%d) "gswin32c.exe" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignTo
Pixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -g612x792  
"-sOutputFile=C:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-A9ezDV_R--0000001" 
"-fC:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick--rFjTHb1" 
"-fC:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-6jc38cAC" -c showpage @ error/utility.c/SystemCommand/2094.

Magick: Postscript delegate failed `C:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-wthGhzQb': No such file or directory @ error/ps.c
/ReadPSImage/806.

Magick: missing an image filename `c:\temp\output\detail.jpg' @ error/convert.c/ConvertImageCommand/2974.
The delegate ralCGM failed... How can I repair this problem please?

Re: Convert CGM to jpg

Posted: 2011-03-24T09:22:00-07:00
by magick
Is ralcgm in your execution path. From the DOS Command Prompt window, does it return an exception if you just type 'ralcgm' on the command line?

Re: Convert CGM to jpg

Posted: 2011-03-24T10:03:38-07:00
by cuicui6669
Hi Magick ,

Yes, ralcgm is in my execution path: i set my "PATH" environnement variable on C:\ralCGM\ralCGM.exe
So, If I just type ralCGM on the command line, it doesn 't return an error... but nothing arrived...

Code: Select all

C:\>ralcgm


RAL CGM Interpreter Version 3.50
or

Code: Select all

C:\temp>ralcgm


RAL CGM Interpreter Version 3.50
Here is my PATH:

Code: Select all

C:\>PATH
PATH=C:\Program Files\ImageMagick-6.6.8-Q16;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Microsoft SQL
 Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Micr
osoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\ralcgm

Re: Convert CGM to jpg

Posted: 2011-03-24T10:41:27-07:00
by magick
We downloaded ImageMagick 6.6.8-6 (the latest release), installed ralcgm, associated c:\Program Files\ralcgm with the PATH environment variable, verified ralcgm ran from the command line, and finally converted ImageMagick-6.6.8-6\PerlMagick\t\input.cgm to PNG (added -verbose to the command line for debugging). The conversion completed without complaint. We are unsure why the CGM conversion fails for you.

Re: Convert CGM to jpg

Posted: 2011-03-25T03:58:54-07:00
by cuicui6669
Hi Magick,

I re-try your process... Can you confirm me if thess following links are good please?

link for ralCGM:
http://www.imagemagick.org/download/del ... _setup.zip from this page http://www.imagemagick.org/download/delegates/

So I just have to install to this directory :
c:\program files\ralcgm
and I set the environment variable
PATH=c:\program files\ralcgm

link for IM:
http://www.imagemagick.org/download/bin ... indows.zip from this page:http://www.imagemagick.org/script/binar ... hp#windows
So I Just have to copy to a directory
C:\Program Files\ImageMagick-6.6.8-8
and I set the environment variable
PATH=c:\program files\ImageMagick-6.6.8-8
That's my PATH:
PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program File
s\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;c
:\python26;c:\program files\ralcgm;C:\Program Files\ImageMagick-6.6.8-8;
that's my command:

Code: Select all

C:\Program Files\ImageMagick-6.6.8-8>convert -verbose c:\temp\sources\detail.cgm c:\temp\output\detail.png
here is the result:

Code: Select all

ralcgm -d ps "C:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-hPjsCaFn." "C:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-_DM_VUoc." "C:
/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-x4Ng-545."
"gswin32c.exe" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignToPixels=0 -dGridFit
TT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -g612x792  "-sOutputFile=C:/DOCUME~1/J8818~1.PAU/LOCALS
~1/Temp/magick-2rfZb2a6-%08d" "-fC:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-E_0TiRO3" "-fC:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/m
agick-kZrp2VI2"
"gswin32c.exe" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignToPixels=0 -dGridFit
TT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -g612x792  "-sOutputFile=C:/DOCUME~1/J8818~1.PAU/LOCALS
~1/Temp/magick-2rfZb2a6-%08d" "-fC:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-E_0TiRO3" "-fC:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/m
agick-kZrp2VI2" -c showpage
convert: Delegate failed `ralcgm -d ps "%i." "%o." "%u."' @ error/delegate.c/InvokeDelegate/1058.
convert: `%s' (%d) "gswin32c.exe" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignT
oPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -g612x792  "-sOutputFile=C:/DOCUME~1
/J8818~1.PAU/LOCALS~1/Temp/magick-2rfZb2a6--0000001" "-fC:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-E_0TiRO3" "-fC:/DOCUME~1/J881
8~1.PAU/LOCALS~1/Temp/magick-kZrp2VI2" @ error/utility.c/SystemCommand/2094.
convert: `%s' (%d) "gswin32c.exe" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignT
oPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -g612x792  "-sOutputFile=C:/DOCUME~1
/J8818~1.PAU/LOCALS~1/Temp/magick-2rfZb2a6--0000001" "-fC:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-E_0TiRO3" "-fC:/DOCUME~1/J881
8~1.PAU/LOCALS~1/Temp/magick-kZrp2VI2" -c showpage @ error/utility.c/SystemCommand/2094.
convert: Postscript delegate failed `C:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-k6qr7BTe': No such file or directory @ error/ps.
c/ReadPSImage/806.
convert: missing an image filename `c:\temp\output\detail.png' @ error/convert.c/ConvertImageCommand/3011.
ARRRRrrrrggggggg :(

Re: Convert CGM to jpg

Posted: 2011-03-25T05:37:07-07:00
by magick
Do you have Ghostscript installed and available from the command line? The ralcgm delegates produces Postscript and Ghostscript is required to interpret the Postscript image file.

Re: Convert CGM to jpg

Posted: 2011-03-25T07:01:21-07:00
by cuicui6669
I haven't Ghostscript installed.

So i get the installer from this following link:
http://pages.cs.wisc.edu/~ghost/doc/GPL/gpl901.htm
And get this file: http://mirror.cs.wisc.edu/pub/mirrors/g ... 901w32.exe

I install it to this directory:
C:\Program Files\Ghostscript
I set my environment path to
PATH=C:\Program Files\Ghostscript\gs9.01\bin
in order to point to "gswin32.exe"

I try this:

Code: Select all

C:\Program Files\ImageMagick-6.6.8-Q16>convert.exe -verbose c:\temp\sources\m_ps_276451_04_aam0_01_04.cgm  c:\temp\output\toto.png
That's the result:

Code: Select all

ralcgm -d ps "C:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-EPF2GKA_." "C:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-1A9fSc7x." "C:
/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-3mmiaMe6."
[ghostscript library] Files/Ghostscript/gs9.01/bin/gswin32c.exe" -q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitm
ap=500000000 -dEPSCrop -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -g612
x792  "-sOutputFile=C:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-T4FbEfT1-%08d" "-fC:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-Uh
eXAdaa" "-fC:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-5xVTsX3c"[ghostscript library] Files/Ghostscript/gs9.01/bin/gswin32c.exe"
-q -dQUIET -dPARANOIDSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dEPSCrop -dAlignToPixels=0 -dGridFitTT=2 "-sDEVICE=
pngalpha" -dTextAlphaBits=4 -dGraphicsAlphaBits=4 "-r72x72" -g612x792  "-sOutputFile=C:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-
T4FbEfT1-%08d" "-fC:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-UheXAdaa" "-fC:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-5xVTsX3c"
 -c showpageC:/DOCUME~1/J8818~1.PAU/LOCALS~1/Temp/magick-T4FbEfT1-00000001 PNG 612x792 612x792+0+0 8-bit DirectClass 3.73KB 0.016u
 0:00.014
c:\temp\sources\m_ps_276451_04_aam0_01_04.cgm CGM 612x792 612x792+0+0 16-bit DirectClass 3.73KB 0.000u 0:00.000
c:\temp\sources\m_ps_276451_04_aam0_01_04.cgm=>c:\temp\output\toto.png CGM 612x792 612x792+0+0 16-bit DirectClass 0.047u 0:00.047
Magick: delegate failed `ralcgm -d ps "%i." "%o." "%u."' @ error/delegate.c/InvokeDelegate/1058.
The file "toto.png" is created but the render is not good...
I try with different cgm files... but it's the same.

I found another problem: I want to open directly a CGM file with IM, and it doesn't work. I have this error:
IMDisplayDoc function [DoReadImage] reported an error.
Magick: delegate failed `ralcgm -d ps "%i." "%o." "%u."' @ error/delegate.c/InvokeDelegate/1058.
Is this error can help us to find a solution to my problem?