Convert bitmap to XYZ table

  • Thread starter Thread starter Filip Kadlec
  • Start date Start date
F

Filip Kadlec

Hello,
I am looking for a prog/ utility which would convert a bitmap to
an ASCII file with XYZ values. The bitmap is only grayscale
and represents a spatial profile of some physical quantity; I
would like to convert it to a 3D graph. After conversion, the XYZ
values would be (for each pixels) the coordinates (X,Y) and the
level of gray (Z = 0 .. 255). Thanks in advance for suggestions.

Filip Kadlec
remove the animals from the address for reply
 
Filip said:
Hello,
I am looking for a prog/ utility which would convert a bitmap to
an ASCII file with XYZ values. The bitmap is only grayscale
and represents a spatial profile of some physical quantity; I
would like to convert it to a 3D graph. After conversion, the XYZ
values would be (for each pixels) the coordinates (X,Y) and the
level of gray (Z = 0 .. 255). Thanks in advance for suggestions.

Filip Kadlec
remove the animals from the address for reply

ImageMagick www.imagemagick.org can be used from the command line, perl,
c, vb, etc.

Here's a command-line example:
convert my_bitmap.bmp -type grayscale gray_values.txt

The output looks something like this:

0,0: 255,255,255 grey100
1,0: 243,243,243 #FEFEFE
2,0: 243,243,243 #FEFEFE
3,0: 122,122,122 #FEFEFE
....

You could pipe the output through awk/gawk if you want to remove the
unused fields.

Andrew Graham
 
Back
Top