Greetings fellow imagers
I am new to imagemagick and I have what seems to me a very simple straight forward task to perform. I have developed software that produces a text file containing data in rows and column format, separated by the [ and ] characters. I cannot send this to a website as a text file. It can only be sent as an image file like jpg. Usually this file takes about half standard printer page but can vary. Imagemagick simply has too many options and parameters for me to make any headway with this conversion. My latest error message for the command line "magick convert fxDtable.txt
fxDtable.jpg" reads;
convert: improper image header 'fxDtable.txt' @ error/txt.c/ReadTXTImage/443.
convert: no images defined 'fxDtable.jpg @ error/convert.c/ConvertImageCommand/3273.
what do I have to add to get this to work ? is it size, draw .... ? There are some entries in the forum about text to image conversion but they have not helped me make sense of this.
Thank You
simple conversion of text report to jpg image file
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: simple conversion of text report to jpg image file
try
In IM 7, use magick in place of convert not both. magick commands need an input and an output.
For novices, see
http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown
https://imagemagick.org/script/porting.php#cli
Code: Select all
magick fxDtable.txt fxDtable.gif
For novices, see
http://www.imagemagick.org/discourse-se ... f=1&t=9620
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/reference.html
http://www.imagemagick.org/Usage/
https://github.com/ImageMagick/usage-markdown
https://imagemagick.org/script/porting.php#cli
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: simple conversion of text report to jpg image file
I suppose you want to rasterize the characters in the text file. The meaning of those characters is not relevant.
Prefix the input test filename with "TEXT:". See http://www.imagemagick.org/Usage/text/#text . For example:
Does that do what you want?
Prefix the input test filename with "TEXT:". See http://www.imagemagick.org/Usage/text/#text . For example:
Code: Select all
magick TEXT:fxDtable.txt fxDtable.jpg
snibgo's IM pages: im.snibgo.com
Re: simple conversion of text report to jpg image file
Thank you for your timely advice. The conversion takes place, but now I see I have another problem. In text, the rows and columns come out perfectly aligned on top of each other. Now the spacing is skewed so the columns do not align properly. Is there any remedy for this ?
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: simple conversion of text report to jpg image file
Please post your input and output files to some free hosting service and put the URLs here so we can see what you are doing. Also identify your exact Imagemagick version and platform/OS.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: simple conversion of text report to jpg image file
Did you read the link I posted?davemagi wrote:In text, the rows and columns come out perfectly aligned on top of each other. Now the spacing is skewed so the columns do not align properly. Is there any remedy for this ?
I purposely used the 'fixed-width' font 'CourierNew' in the above so as to preserve the character spaced formatting that is present in the printed page.
snibgo's IM pages: im.snibgo.com
Re: simple conversion of text report to jpg image file
I am using version 7.0.8-Q16 on a Windows 8.1 system
Sorry I missed that point about the CourierNew. I retried the command line with the font specified (-font CourierNew text:input output)but now it tells me;
unable to read font 'CourierNew' @ warning/annotate.c/RenderType/953
The other parameters specified in the link example i.e. | col -b | expand | \ were not clear to me as to the necessity of using them. As to not finding the font, outside of adding the ImageMagick directory to the Path, I have not changed anything. I could also use the output as a pdf file if this would make anything easier and more comprehensible. I tried doing it and although a pdf file was produced, the Adobe reader claimed the file was damaged and could not be read.
The following is a partial sample of the text file to be converted although it did not come out aligned in the copy command. Basically every [ and ] character in my report is aligned above and below each other in the order they appear in the line.
[ GJ ] EU ] GU ] AU ] AJ ] GN ] EJ ] CJ ] EA ] GA ] NU ] NJ ] EN ] UJ ] UC ] EC ] EG ] UCh] GCh] GC ] AN ] AC ]
Trend: [BAll]Bl52]HML ]Bl52]Bl52]HML ]Bl52]Ab20]AAll]A200]Bl52]Bl52]LMH ]Bl52]Ab50]Bl52]LMH ]Ab50]HML ]HML ]Ab50]HML ]
MAOrd: [5202]2052]5202]2052]2052]2520]2052]2052]2205]2520]2052]2052]2025]2052]2520]2052]2025]2520]5220]5220]2025]2052]
Cndle: [ ]SpTp]LgUS]SpTp]SpTp] ]C>YH]C>YH]SpTp] ]C<YL]SpTp]C>YH]C>YH]C<YL]C<YL]LgLS] ]LgUS]C<YL]SpTp]C<YL]
Cndle2: [ ]DbPB] ]DbPB]DbPB] ] ] ]DbPB] ] ]DbPB] ] ] ] ] ] ] ] ] ] ]
Thank You again for all assistance rendered
Sorry I missed that point about the CourierNew. I retried the command line with the font specified (-font CourierNew text:input output)but now it tells me;
unable to read font 'CourierNew' @ warning/annotate.c/RenderType/953
The other parameters specified in the link example i.e. | col -b | expand | \ were not clear to me as to the necessity of using them. As to not finding the font, outside of adding the ImageMagick directory to the Path, I have not changed anything. I could also use the output as a pdf file if this would make anything easier and more comprehensible. I tried doing it and although a pdf file was produced, the Adobe reader claimed the file was damaged and could not be read.
The following is a partial sample of the text file to be converted although it did not come out aligned in the copy command. Basically every [ and ] character in my report is aligned above and below each other in the order they appear in the line.
[ GJ ] EU ] GU ] AU ] AJ ] GN ] EJ ] CJ ] EA ] GA ] NU ] NJ ] EN ] UJ ] UC ] EC ] EG ] UCh] GCh] GC ] AN ] AC ]
Trend: [BAll]Bl52]HML ]Bl52]Bl52]HML ]Bl52]Ab20]AAll]A200]Bl52]Bl52]LMH ]Bl52]Ab50]Bl52]LMH ]Ab50]HML ]HML ]Ab50]HML ]
MAOrd: [5202]2052]5202]2052]2052]2520]2052]2052]2205]2520]2052]2052]2025]2052]2520]2052]2025]2520]5220]5220]2025]2052]
Cndle: [ ]SpTp]LgUS]SpTp]SpTp] ]C>YH]C>YH]SpTp] ]C<YL]SpTp]C>YH]C>YH]C<YL]C<YL]LgLS] ]LgUS]C<YL]SpTp]C<YL]
Cndle2: [ ]DbPB] ]DbPB]DbPB] ] ] ]DbPB] ] ]DbPB] ] ] ] ] ] ] ] ] ] ]
Thank You again for all assistance rendered
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: simple conversion of text report to jpg image file
"magick -list font" will list available fonts. On my Windows 8.1 machine, the font is called "Courier-New".
Code: Select all
magick -font Courier-New TEXT:in.txt out.png
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: simple conversion of text report to jpg image file
If your type.xml file does not include a font, then you will either need to edit the type.xml file or use the path to the font file rather than just its name.