0

I'm trying to convert text-based table to the image, but the structure is broken after convertation.

I have file with the next structure:

enter image description here

+-----------+------+------------+-----------------+
| City name | Area | Population | Annual Rainfall |
+-----------+------+------------+-----------------+
|  Adelaide | 1295 |  1158259   |      600.5      |
|  Brisbane | 5905 |  1857594   |      1146.4     |
|   Darwin  | 112  |   120900   |      1714.7     |
|   Hobart  | 1357 |   205556   |      619.5      |
|   Sydney  | 2058 |  4336374   |      1214.8     |
| Melbourne | 1566 |  3806092   |      646.9      |
|   Perth   | 5386 |  1554769   |      869.4      |
+-----------+------+------------+-----------------+%   

after a conversation with ImageMagick and command below:

convert label:"$(cat test.txt)" result1.png 

I have next image:

enter image description here

As you can see, the structure of the columns is broken. Do you have an idea of how can such an issue be solved?

Regards, Ihor

emcconville
  • 23,800
  • 4
  • 50
  • 66

1 Answers1

1

You need to set the TypeFace to something monospace to match the terminal.

convert -font "Liberation-Mono" label:@test.txt result1.png

result

You can identify which fonts on the system by running

identify -list font | grep Mono
emcconville
  • 23,800
  • 4
  • 50
  • 66