home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / prog / arexx / scripti.lha / 3-DEE / Scripti / Composition / Emboss.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1993-05-22  |  3.6 KB  |  169 lines

  1. /*
  2. ----------------------------------------------------------------------------
  3. This AREXX-Script will make any image embossed.
  4. If the image is 24Bit, it will be saved as 24Bit.
  5. If you have an AGA machine, it will save 256 colors or less.
  6. If you don't, it will save 32 colors or less.
  7.  
  8. Host address: ADPro (Art Department Professional   ®ASDG)
  9. Written by Jan Van Overbeke, 3-DEE, ©1993.
  10. Read the AREXX-Scripti doc, for more info about operation and rights!
  11. ----------------------------------------------------------------------------
  12. */
  13.  
  14. arg filename c offX offY
  15. if ~exists(filename)|filename='' then do
  16.     say 'Unable to find the image !!'
  17.     say 'See Ya...'
  18.     say ''
  19.     exit
  20.     end
  21.  
  22. if ~(c='COLOR'|c='GRAY')|c='' then do
  23.     say 'Invalid argument! Read the doc!'
  24.     say 'See Ya.....'
  25.     say ''
  26.     exit
  27.     end
  28.  
  29. if offX='' then offX=1
  30. if offY='' then offY=1
  31.  
  32. options results
  33. address 'ADPro'
  34. say 'Emboss: Written by Jan Van Overbeke, 3-DEE, ©1993'
  35. say 'Image: 'filename
  36. say 'SAVE: =<256 / =<32 / 24Bit'
  37. say ''
  38.  
  39. SFORMAT "IFF"
  40. if RC~=0 then do
  41.     say 'Unable to select the IFF saver.'
  42.     say 'See Ya.....'
  43.     say ''
  44.     exit
  45.     end
  46.  
  47. LFORMAT "UNIVERSAL"
  48. if RC ~=0 then do
  49.     say 'Unable to select the UNIVERSAL loader.'
  50.     say 'See Ya.......'
  51.     say ''
  52.     exit
  53.     end
  54.  
  55. say 'Loading.........'
  56. LOAD filename
  57. if RC ~=0 then do
  58.     say 'Had some problems while loading.'
  59.     say 'See Ya...'
  60.     say ''
  61.     exit
  62.     end
  63.  
  64. /* ----   Get info about image: is it 24Bit? is it gray? ---- */
  65. /* ---- If it is gray, and if gray emboss is requested,  ---- */
  66. /* ----      we'll have to do something about it         ---- */
  67. /* ---------------------------------------------------------- */
  68. IMAGE
  69. help=ADPRO_RESULT
  70. dontrender='ok'
  71. if pos('Rendered',help)>0|pos('BITPLANE',help)>0 then dontrender='nok'
  72. if word(help,1)~='GRAY' & c='GRAY' then do
  73.     say 'Converting image to gray.....'
  74.     operator Color_To_Gray
  75.     if RC~=0 then do
  76.         say 'Unable to operate the Color_to_gray operator!!!!'
  77.         say 'See Ya.......'
  78.         say ''
  79.         exit
  80.         end
  81.     end
  82.  
  83. say 'Saving1 24Bit......'
  84. save 'ram:1' "RAW"
  85. if RC~=0 then do
  86.     say 'This save failed!!!!!!!!'
  87.     say 'See Ya...'
  88.     say ''
  89.     exit
  90.     end
  91.  
  92. say 'Making image Negative.'
  93. operator Negative
  94. if RC ~=0 then do
  95.     say 'Unable to select the Negative operator.'
  96.     say 'See Ya...'
  97.     say ''
  98.     exit
  99.     end
  100.  
  101. say 'Saving2 24Bit......'
  102. save 'ram:2' "RAW"
  103. if RC~=0 then do
  104.     say 'This save failed!!!!!!!!'
  105.     say 'See Ya......'
  106.     say ''
  107.     exit
  108.     end
  109.  
  110. say 'Loading 1st part of Emboss.'
  111. load 'ram:1'
  112. if RC~=0 then do
  113.     say 'Error loading.'
  114.     say 'See Ya.....'
  115.     say ''
  116.     exit
  117.     end
  118.  
  119. address COMMAND 'delete >NIL: ram:1'
  120. say 'Loading 2nd part of Emboss.'
  121. LOAD 'ram:2' offX OffY 50 -1 -1 -1
  122. if RC ~=0 then do
  123.     say 'Had some problems while compositing.'
  124.     say 'See Ya.'
  125.     say ''
  126.     exit
  127.     end
  128.  
  129. /* ----       That was basic Emboss routine:       ---- */
  130. /* ---- overlay the (gray) image with its negative ---- */
  131. /* ----            with a little offset            ---- */
  132. /* ----            and mix it 50 percent           ---- */
  133. /* ---------------------------------------------------- */
  134.  
  135.  
  136. /* ---- If the original image was not 24bit, all palette and image ---- */
  137. /* ----               settings must fit the gray data.             ---- */
  138. /* -------------------------------------------------------------------- */
  139. address COMMAND 'delete >NIL: ram:2'
  140. if dontrender='nok' then do
  141.     savemode="IMAGE"
  142.     say 'Converting......'
  143.     render_type
  144.     colors=ADPRO_RESULT
  145.     ptotal colors
  146.     pused colors
  147.     execute
  148.     if RC ~= 0 then do
  149.         say 'Execute failed.'
  150.         say 'See Ya...'
  151.         say ''
  152.         exit
  153.         end
  154.     say 'Saving IMAGE 'colors'....'
  155.     end
  156.     else do
  157.         savemode="RAW"
  158.         say 'Saving 'savemode'....'
  159.          end
  160.  
  161. filename=filename'.new'
  162. SAVE filename savemode
  163. if RC~=0 then do
  164.     say 'Problems while saving: NOT SAVED.'
  165.     say 'See Ya...'
  166.     end
  167. say ''
  168. exit
  169.