Page 1 of 1

WMF conversion to GIF with national character

Posted: 2009-05-07T02:24:41-07:00
by alexis.be
I'm currently trying to convert wmf files to gif.
Original file contains realestate 2D description (walls, doors, windowsfurnitures,...) as well as quotes (room dimension) and some extra text description. The latter may contain some national characters with accents.
While converting wmf to gif through straightfoward 'convert in.wmf out.gif' CLI command, all drawings are fine, except the national characters with accents appearing as non conform character.
I mean by this that for instance a 'é' is not replaced by a non-accente equivalent letter as 'e', but by an uppercase 'O' with surimpressed '/', looking more like Nordic to French.

I've looked to the IM/Usage/text handling documentation, re. unicode rendering and other sources, but could not figure out how to solve this issue.

Thanks for your help.

Current IM version is 6.3.7 on Linux Ubuntu 8.04 with libwmf installed.

Re: WMF conversion to GIF with national character

Posted: 2009-05-07T19:46:19-07:00
by anthony
IM calls a delegate to handle WMF vector files.

install the program "wmf2eps"


See more about delegates in IM examples, File Handling
http://www.imagemagick.org/Usage/files/#delegates

Also list whare delegates your IM knows about, using...
convert -list delegate

Re: WMF conversion to GIF with national character

Posted: 2009-05-09T13:46:43-07:00
by alexis.be
Anthony,

thks for such quick reply.
I checked the 'delegates' available on my IM installation, and found last line as such : wmf => "wmf2eps" -o "%o" "%i"
'wmf2eps' command is also installed on my server, as running 'wmf2eps --help' command provides me with extra information on the package.
Running 'wmf2eps --version' gives me
libwmf: version 0.2.8

So next question is what's next step ?
- should I install another version of IM (current 6.3.7) ?
- should I configure IM and adapt the delegates.xml a bit ?
- should I adapt the convert command line so wmf to gif conversion is made another way ?

Sorry Anthony if those questions are either too straightforward or too far from any IM understanding.
Thanks for your help, you and the community of course.

Re: WMF conversion to GIF with national character

Posted: 2009-05-10T21:29:52-07:00
by anthony
well if

Code: Select all

convert  image.wmf  image.png
does not work you may have to turn on some debugging options to see what is going wrong.

Re: WMF conversion to GIF with national character

Posted: 2009-05-11T00:51:49-07:00
by alexis.be
Anthony,
Thanks for the debugging tip. I appended the result here below. At first sight, it seems IM does not find any coder.xml and magic.xml files which might be the one full of proper indications on how to deal with the national characters.
Furthermore, looking in the previously posted questions and answers, it seems some 'locale.xml' file might be required and accessed by some convert operations (cfr viewtopic.php?f=3&t=11123).

I don't know exactly what should be in those 2 .xml files. You might provide me with some resources to look at.

convert -debug All -log "%u %m:%l %e" IM_original.wmf IM_wmf2gif.gif
2009-05-11T09:39:38+02:00 0:01 0.000u 6.3.7 Configure convert[8288]: utility.c/unknown/809/Configure
Command line: convert {-debug} {All} {-log} {%u %m:%l %e} {IM_original.wmf} {IM_wmf2gif.gif}
0.000u configure.c:482 Searching for configure file: "/usr/lib/ImageMagick-6.3.7/config/coder.xml"
0.000u configure.c:482 Searching for configure file: "/usr/share/ImageMagick-6.3.7/config/coder.xml"
0.000u configure.c:482 Searching for configure file: "/usr/share/doc/ImageMagick-6.3.7/coder.xml"
0.000u configure.c:482 Searching for configure file: "/usr/share/ImageMagick-6.3.7/coder.xml"
0.000u configure.c:482 Searching for configure file: "/root/.magick/coder.xml"
0.000u configure.c:482 Searching for configure file: "coder.xml"
0.000u configure.c:507 unable to access configure file `coder.xml'
0.000u coder.c:630 Loading coder map "built-in" ...
0.000u module.c:1074 Searching for module "WMF" using filename "wmf.la"
0.000u module.c:479 Searching for coder module file "wmf.la" ...
0.000u module.c:1094 Opening module at path "/usr/lib/ImageMagick-6.3.7/modules-Q16/coders/wmf.la"
0.000u module.c:1128 Method "RegisterWMFImage" in module "WMF" at address 0xb7f52570
0.000u module.c:1143 Method "UnregisterWMFImage" in module "WMF" at address 0xb7f52530
0.000u blob.c:2324 read 3760 magic header bytes
0.000u cache.c:2162 destroy
0.000u configure.c:482 Searching for configure file: "/usr/lib/ImageMagick-6.3.7/config/magic.xml"
0.000u configure.c:482 Searching for configure file: "/usr/share/ImageMagick-6.3.7/config/magic.xml"
0.000u configure.c:482 Searching for configure file: "/usr/share/doc/ImageMagick-6.3.7/magic.xml"
0.000u configure.c:482 Searching for configure file: "/usr/share/ImageMagick-6.3.7/magic.xml"
0.000u configure.c:482 Searching for configure file: "/root/.magick/magic.xml"
0.000u configure.c:482 Searching for configure file: "magic.xml"
0.000u configure.c:507 unable to access configure file `magic.xml'
0.000u magic.c:870 unable to access configure file `'
0.000u magic.c:678 Loading magic map "built-in" ...
0.010u blob.c:2324 read 3760 magic header bytes
0.010u cache.c:2162 destroy
0.010u configure.c:482 Searching for configure file: "/usr/lib/ImageMagick-6.3.7/config/delegates.xml"
0.010u configure.c:482 Searching for configure file: "/usr/share/ImageMagick-6.3.7/config/delegates.xml"
0.010u configure.c:482 Searching for configure file: "/usr/share/doc/ImageMagick-6.3.7/delegates.xml"
0.010u configure.c:482 Searching for configure file: "/usr/share/ImageMagick-6.3.7/delegates.xml"
0.010u configure.c:482 Searching for configure file: "/root/.magick/delegates.xml"
0.010u configure.c:482 Searching for configure file: "delegates.xml"
0.010u delegate.c:1152 Loading delegate map "/usr/lib/ImageMagick-6.3.7/config/delegates.xml" ...
0.010u resource.c:418 /tmp/magick-XXRinCrg
0.010u resource.c:418 /tmp/magick-XXrwjlwz
0.010u resource.c:855 /tmp/magick-XXrwjlwz
0.010u resource.c:418 /tmp/magick-XXWxX5AS
0.010u resource.c:418 /tmp/magick-XXSpiRFb
0.010u resource.c:418 /tmp/magick-XXjsyDKu
0.010u resource.c:855 /tmp/magick-XXjsyDKu
0.010u resource.c:855 /tmp/magick-XXjsyDKu
0.010u resource.c:855 /tmp/magick-XXWxX5AS
0.010u resource.c:855 /tmp/magick-XXSpiRFb
0.010u resource.c:855 /tmp/magick-XXrwjlwz
0.010u cache.c:2162 destroy
0.010u blob.c:2324 read 4096 magic header bytes
0.010u cache.c:2162 destroy
0.010u module.c:1074 Searching for module "PS" using filename "ps.la"
0.010u module.c:479 Searching for coder module file "ps.la" ...
0.010u module.c:1094 Opening module at path "/usr/lib/ImageMagick-6.3.7/modules-Q16/coders/ps.la"
0.010u module.c:1128 Method "RegisterPSImage" in module "PS" at address 0xb77bc140
0.010u module.c:1143 Method "UnregisterPSImage" in module "PS" at address 0xb77bc0e0
0.010u blob.c:2324 read 4096 magic header bytes
0.010u resource.c:418 /tmp/magick-XXY9RU0O
0.010u resource.c:855 /tmp/magick-XXY9RU0O
0.020u resource.c:418 /tmp/magick-XXPoznh9
0.020u resource.c:418 /tmp/magick-XXxubTxt
0.020u blob.c:2324 read 4096 magic header bytes
0.020u cache.c:2162 destroy
0.020u module.c:1074 Searching for module "PNG" using filename "png.la"
0.020u module.c:479 Searching for coder module file "png.la" ...
0.020u module.c:1094 Opening module at path "/usr/lib/ImageMagick-6.3.7/modules-Q16/coders/png.la"
0.020u module.c:1128 Method "RegisterPNGImage" in module "PNG" at address 0xb77a12f0
0.020u module.c:1143 Method "UnregisterPNGImage" in module "PNG" at address 0xb77a1250
0.020u png.c:2807 enter ReadPNGImage()
0.020u blob.c:2324 read 4096 magic header bytes
0.020u png.c:1671 enter ReadOnePNGImage()
0.020u png.c:1796 PNG width: 1025, height: 1828
0.020u png.c:1799 PNG color_type: 6, bit_depth: 8
0.020u png.c:1802 PNG compression_method: 0
0.020u png.c:1805 PNG interlace_method: 0, filter_method: 0
0.020u png.c:1940 Reading PNG pHYs chunk: xres: 2834, yres: 2834, units: 1.
0.020u png.c:2032 Reading PNG bKGD chunk.
0.020u png.c:2205 Reading PNG IDAT chunk(s)
0.020u png.c:2217 Converting PNG pixels to pixel packets
0.020u resource.c:216 Area: 14.2952mb/14.2952mb/3.92778gb
0.020u resource.c:216 Memory: 14.2952mb/14.2952mb/2.94584gb
0.020u cache.c:3525 open /tmp/magick-XXxubTxt[0] (anonymous memory, 1025x1828 14.2952mb)
0.200u png.c:2641 Reading PNG text chunk
0.200u png.c:2664 Keyword: Software
0.200u png.c:2768 exit ReadOnePNGImage()
0.200u png.c:2872 exit ReadPNGImage()
0.200u resource.c:855 /tmp/magick-XXxubTxt
0.200u resource.c:855 /tmp/magick-XXPoznh9
0.200u resource.c:855 /tmp/magick-XXxubTxt
0.200u resource.c:855 /tmp/magick-XXY9RU0O
0.200u cache.c:2162 destroy
0.200u resource.c:855 /tmp/magick-XXRinCrg
0.200u module.c:1074 Searching for module "GIF" using filename "gif.la"
0.200u module.c:479 Searching for coder module file "gif.la" ...
0.200u module.c:1094 Opening module at path "/usr/lib/ImageMagick-6.3.7/modules-Q16/coders/gif.la"
0.200u module.c:1128 Method "RegisterGIFImage" in module "GIF" at address 0xb77e0520
0.200u module.c:1143 Method "UnregisterGIFImage" in module "GIF" at address 0xb77e04e0
1.150u resource.c:216 Area: 17.869mb/17.869mb/3.92778gb
1.150u resource.c:216 Memory: 17.869mb/32.1642mb/2.94584gb
1.150u cache.c:3525 open IM_wmf2gif.gif[0] (anonymous memory, 1025x1828 17.869mb)
1.150u cache.c:1928 memory => memory
1.190u resource.c:822 Memory: 14.2952mb/17.869mb/2.94584gb
2.030u resource.c:822 Memory: 17.869mb/0b/2.94584gb
2.030u cache.c:2162 destroy IM_wmf2gif.gif[0]

So Anthony, you might find in there what is missing.
Thanks for your help anyhow
Best regards

Re: WMF conversion to GIF with national character

Posted: 2009-05-11T16:17:34-07:00
by anthony
I would say then that your IM is not installed correctly.

You can download them from the SVN repository or sources archives. They should be located in the 'config' sub-directory.

Coder.xml appears to map alturnative 'suffixes' to a coders real name. For example JPG maps to JPEG. and WMZ maping to WMF

The local.xml file however maps the UNIX environment variable LOCALE string to the right language XML file needed to report errors in the correct language of the user.

I don't think either is vital to the reading of WMF files.

On the other hand "magic.xml" is vital as it maps the special strings found in a image file format, to the correct format needed for decoding.

After that it continues to try reading the file via "delegates" which appears to work,
Do you have ghostscript installed? This is needed to decode the Postscript generated by wmf2ps.

Re: WMF conversion to GIF with national character

Posted: 2009-05-12T01:50:28-07:00
by alexis.be
Anthony,
Ghostscript is installes as
ghostscript command returns
GPL Ghostscript 8.61 (2007-11-21)

Might it be outdated ?
I'll check the SVN of IM too whenever I can grasp some freetime.
Thanks again

Re: WMF conversion to GIF with national character

Posted: 2009-05-12T18:40:29-07:00
by anthony
Sorry no idea. My linux system has always kept it up to date enough!
It is currently using the package ghostscript-8.63-6.fc10