/usr/share/gnudatalanguage/lib/write_image.pro is in libgnudatalanguage0 0.9.6v2-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | ;+
;
; NAME: WRITE_IMAGE
;
; PURPOSE: write an image file (and colors tables) onto file
;
; CATEGORY: Images (IO)
;
; CALLING SEQUENCE:
; WRITE_IMAGE, filename, format, image, [red, green, blue], /append
;
; KEYWORD PARAMETERS:
; APPEND: not supported yet
;
; OUTPUTS: [n,m], [2,n,m], [3,n,m], [4,n,m] following image properties
; (transparency adds one extra Dim)
;
; OPTIONAL OUTPUTS: For pseudocolor only: Red, Green, Blue
;
; SIDE EFFECTS:
;
; RESTRICTIONS:
; Requires ImageMagick (that means that GDL must have been
; compiled with ImageMagick)
;
; PROCEDURE:
; Use ImageMagick to read the data as requested
;
; EXAMPLE: An image of Saturn should be around in the GDL CVS
;
; file=FILE_WHICH('Saturn.jpg')
; image=READ_IMAGE(file, image)
; TV, image, /true
; WRITE_IMAGE, 'Saturn.png', 'png', image
;
; MODIFICATION HISTORY:
; Initial version written by: Alain Coulais, 2012-02-15
; 2012-Feb-12, Alain Coulais :
;
;-
; LICENCE:
; Copyright (C) 2012
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
;-
;
pro WRITE_IMAGE, filename, format, image, red, green, blue, $
append=append, help=help, test=test
;
; this line allows to compile also in IDL ...
FORWARD_FUNCTION MAGICK_EXISTS, MAGICK_PING, MAGICK_READ
;
if KEYWORD_SET(help) then begin
print, 'pro WRITE_IMAGE, filename, format, image, red, green, blue, $'
print, ' append=append, help=help, test=test'
return
endif
;
; Do we have access to ImageMagick functionnalities ??
;
if (MAGICK_EXISTS() EQ 0) then begin
MESSAGE, /continue, "GDL was compiled without ImageMagick support."
MESSAGE, "You must have ImageMagick support to use this functionaly."
endif
;
if ((N_PARAMS() EQ 0) OR (N_PARAMS() GT 6)) then $
MESSAGE, "Incorrect number of arguments."
;
if (STRLEN(filename) EQ 0) then MESSAGE, "Null filename not allowed."
;
case STRUPCASE(format) of
'JPEG' : begin
if (N_ELEMENTS(red) GT 0) then begin
;; AC 2014-Aug-10: this code is not OK within current version
;; of WRITE_JPEG
;;
;;colortable=BYTARR(256,3)
;;colortable[*,0]=red
;;colortable[*,1]=green
;;colortable[*,2]=blue
;; WRITE_JPEG, filename, image, colortable, colors=256
;;
;; but not sure this is better ! help welcome
;;
TVLCT, red, green, blue
WRITE_JPEG, filename, image
endif else begin
WRITE_JPEG, filename, image
endelse
end
'PNG' : WRITE_PNG, filename, image, red, green, blue
'GIF' : WRITE_GIF, filename, image, red, green, blue
else: MESSAGE, 'This format is not managed today, please contribute'
endcase
;
if KEYWORD_SET(test) then STOP
;
end
|