Tuesday, October 6, 2009

Image Padding in IDL

; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

;                       IMAGE PADDING

;              Author:  S.Ganesh Babu

; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

PRO EX24

earth = READ_PNG(FILEPATH('avhrr.png', SUBDIRECTORY = ['examples','data']),r,g,b)

DEVICE, DECOMPOSED = 0, RETAIN = 2

TVLCT, r,g,b

maxColor = !D.TABLE_SIZE - 1

TVLCT, 255,255,255, maxColor

sz = SIZE(earth,/DIMENSIONS)

pearth = REPLICATE(BYTE(maxColor),sz[0]+20,sz[1]+40)

pearth[10,10]=earth

WINDOW,0, XSIZE=sz[0]+20,YSIZE=sz[1]+40

TV,pearth

END

; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

;                       IMAGE PADDING

;              Author:  S.Ganesh Babu

; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

PRO EX24

earth = READ_PNG(FILEPATH('avhrr.png', SUBDIRECTORY = ['examples','data']),r,g,b)

DEVICE, DECOMPOSED = 0, RETAIN = 2

TVLCT, r,g,b

maxColor = !D.TABLE_SIZE - 1

TVLCT, 255,255,255, maxColor

sz = SIZE(earth,/DIMENSIONS)

pearth = REPLICATE(BYTE(maxColor),sz[0]+20,sz[1]+40)

pearth[10,10]=earth

WINDOW,0, XSIZE=sz[0]+20,YSIZE=sz[1]+40

TV,pearth

END

No comments: