~ubuntu-branches/debian/jessie/eso-midas/jessie

« back to all changes in this revision

Viewing changes to applic/proc/outima.prg

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-04-22 14:44:58 UTC
  • Revision ID: package-import@ubuntu.com-20140422144458-okiwi1assxkkiz39
Tags: upstream-13.09pl1.2+dfsg
ImportĀ upstreamĀ versionĀ 13.09pl1.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
! ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
2
!
 
3
! MIDAS procedure outima.prg  to convert Midas images to other image formats
 
4
! K. Banse      941020, 941107, 040929
 
5
 
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.
 
12
!                 JPEG
 
13
!                 MIFF  Magick image file format.
 
14
!                 PCX   ZSoft IBM PC Paintbrush file.
 
15
!                 PICT  Apple Macintosh QuickDraw/PICT file.
 
16
!                 PNM   Portable bitmap.
 
17
!                 PS    Adobe PostScript
 
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.
 
24
 
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
 
27
 
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)
 
33
 
34
!  The output name will be:
 
35
!      frame name + format (in lowercase) as file type.
 
36
 
37
! ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
38
!
 
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: "
 
43
define/maxpar 4
 
44
define/local lutname/c/1/60 {p3}
 
45
 
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,"]")
 
50
else
 
51
   nn(2) = m$indexb(p1,"/")
 
52
endif
 
53
if nn(1) .gt. nn(2) then                !define root of output frame
 
54
   nn = nn-1
 
55
   define/local outa/c/1/60 {p1(1:{nn})}
 
56
else
 
57
   define/local outa/c/1/60 {p1}
 
58
endif
 
59
 
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)}
 
65
   else
 
66
      lutname = "x_y_outima.lut"
 
67
   endif
 
68
endif
 
69
 
70
! build up the Postscript file
 
71
 
72
if lutname(1:8) .eq. "ramp.lut" then
 
73
   copy/pscr {p1} {outa}.ps 
 
74
else
 
75
   copy/pscr {p1} {outa}.ps p6={lutname}
 
76
endif
 
77
 
78
! now convert if necessary
 
79
 
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
 
100
   goto end
 
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
 
113
else
 
114
   write/out {p2} is an unknown output format
 
115
   return
 
116
endif
 
117
 
118
! use ImageMagick for conversion Postscript -> {p2} format
 
119
 
120
$convert {outa}.ps {outfile}
 
121
 
122
end:
 
123
define/local format/c/1/8 " " all
 
124
format = m$upper(p2)
 
125
write/out {format} format file `{outfile}' created...