1
! ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3
! MIDAS procedure outima.prg to convert Midas images to other image formats
4
! K. Banse 941020, 941107, 040929
6
! execute via @a outima frame format [LUTname] [ITTname]
7
! with frame = name of input Midas image
8
! format = AVS AVS X image file.
9
! BMP Microsoft Windows bitmap image file.
10
! EPS Adobe Encapsulated PostScript file.
11
! GIF Compuserve Graphics image file.
13
! MIFF Magick image file format.
14
! PCX ZSoft IBM PC Paintbrush file.
15
! PICT Apple Macintosh QuickDraw/PICT file.
16
! PNM Portable bitmap.
18
! TGA Truevision Targa image file.
19
! TIFF Tagged Image File Format.
20
! VIFF Khoros Visualization image file.
21
! XBM X11 bitmap file.
22
! XPM X11 pixmap file.
23
! XWD X Window System window dump image file.
25
! LUT name = name of MIDAS LUT, e.g. heat; defaulted to ramp
26
! ITT name = name of MIDAS ITT, e.g. log; defaulted to ramp
28
! The conversion is done via transforming the MIDAS image to PostScript
29
! format and then applying the public domain package `ImageMagick'.
30
! I.e. this software must be installed at your site - otherwise this
31
! procedure will not work...
32
! (the PostScript conversion is always possible)
34
! The output name will be:
35
! frame name + format (in lowercase) as file type.
37
! ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
39
define/para p1 ? ima "Enter image name: "
40
define/para p2 GIF c "Enter output format: "
41
define/para p3 ramp.lut c "Enter LUT: "
42
define/para p4 + c "Enter ITT: "
44
define/local lutname/c/1/60 {p3}
46
define/local nn/i/1/2 0,0
47
nn(1) = m$indexb(p1,".")
48
if aux_mode(1) .eq. 1 then
49
nn(2) = m$indexb(p1,"]")
51
nn(2) = m$indexb(p1,"/")
53
if nn(1) .gt. nn(2) then !define root of output frame
55
define/local outa/c/1/60 {p1(1:{nn})}
57
define/local outa/c/1/60 {p1}
60
! if ITT required, we have to map LUT through it
61
if p4(1:1) .ne. "+" then
62
@a mapitt {p4} {p3} x_y_outima
63
if inputi .ne. -4321 then
64
delete/display {inputi(17)}
66
lutname = "x_y_outima.lut"
70
! build up the Postscript file
72
if lutname(1:8) .eq. "ramp.lut" then
73
copy/pscr {p1} {outa}.ps
75
copy/pscr {p1} {outa}.ps p6={lutname}
78
! now convert if necessary
80
if p2(1:3) .eq. "AVS" then
81
define/local outfile/c/1/60 {outa}.avs
82
else if p2(1:3) .eq. "BMP" then
83
define/local outfile/c/1/60 {outa}.bmp
84
else if p2(1:1) .eq. "E" then
85
define/local outfile/c/1/60 {outa}.eps
86
else if p2(1:1) .eq. "G" then
87
define/local outfile/c/1/60 {outa}.gif
88
else if p2(1:1) .eq. "J" then
89
define/local outfile/c/1/60 {outa}.jpeg
90
else if p2(1:1) .eq. "M" then
91
define/local outfile/c/1/60 {outa}.miff
92
else if p2(1:3) .eq. "PCX" then
93
define/local outfile/c/1/60 {outa}.pcx
94
else if p2(1:3) .eq. "PIC" then
95
define/local outfile/c/1/60 {outa}.pict
96
else if p2(1:3) .eq. "PNM" then
97
define/local outfile/c/1/60 {outa}.pnm
98
else if p2(1:2) .eq. "PS" then
99
define/local outfile/c/1/60 {outa}.ps
101
else if p2(1:2) .eq. "TG" then
102
define/local outfile/c/1/60 {outa}.tga
103
else if p2(1:2) .eq. "TI" then
104
define/local outfile/c/1/60 {outa}.tiff
105
else if p2(1:1) .eq. "V" then
106
define/local outfile/c/1/60 {outa}.viff
107
else if p2(1:3) .eq. "XBM" then
108
define/local outfile/c/1/60 {outa}.xbm
109
else if p2(1:3) .eq. "XPM" then
110
define/local outfile/c/1/60 {outa}.xpm
111
else if p2(1:3) .eq. "XWD" then
112
define/local outfile/c/1/60 {outa}.xwd
114
write/out {p2} is an unknown output format
118
! use ImageMagick for conversion Postscript -> {p2} format
120
$convert {outa}.ps {outfile}
123
define/local format/c/1/8 " " all
125
write/out {format} format file `{outfile}' created...