Inform me () when using this script or encorporating it in a library.
Source code of enlarge.pro:
;+
; NAME:
; ENLARGE
; PURPOSE:
; Enlarge an array for the purpose of being displayed with tv,
; but not to loose the separate pixel information, which is when
; one uses the IDL REBIN function. Is only useful when a direct
; tv command is given. Otherwise one should rather use xsize
; and/or ysize with tv.
; CALLING SEQUENCE:
; result = ENLARGE(input, factor[, /smooth])
; EXAMPLES:
; result = ENLARGE(input, 10)
; enlarges with a factor of 10
; result = ENLARGE(input, 10, /smooth)
; uses the REBIN command with a factor of 10 in both
; directions.
; KEYWORDS:
; input = input array (2D)
; factor = integer factor by which the array has to be enlarged
; /smooth = use the interpolating influence of REBIN
; MODIFICATION HISTORY:
; 26/09/05 Written by Eduard Westra
; 27/09/05 Separated into file (EW)
; 27/09/05 Added the /smooth option and help header (EW)
; 29/09/05 Seems to be a huge bug in the program, which seems to
; chop off the top, which is caused by integer chops (EW)
;-
FUNCTION enlarge, input, factor, smooth=smooth, help=help
IF NOT KEYWORD_SET(input) OR KEYWORD_SET(help) THEN BEGIN & doc_library, 'enlarge' & RETURN, 0 & ENDIF
IF NOT KEYWORD_SET(smooth) THEN smooth = 0
sz = size(input)
IF smooth NE 0 THEN BEGIN
output = REBIN(input, factor*sz[1:sz[0]])
RETURN, output
ENDIF
IF (sz[0] NE 2) THEN BEGIN
print, 'Not a 2D array...'
return, input
ENDIF
idx = INDGEN(sz[N_ELEMENTS(sz)-1], /UL64)
col = idx MOD sz[1]
row = (idx - col)/sz[1]
output = MAKE_ARRAY(factor*sz[1:2], TYPE=sz[N_ELEMENTS(sz)-2])
newx = (size(output))[1]
FOR i = 0, factor-1 DO BEGIN
FOR j = 0, factor-1 DO BEGIN
newrow = row*factor+i
newcol = col*factor+j
newidx = newrow*newx + newcol
output[newidx] = input
ENDFOR
ENDFOR
RETURN, output
END