	pro pngit,png_file
; *****************************************************************
; * Create a png file for output
; *****************************************************************
    COMMON misc,TRUE,FALSE
    COMMON graphics,USE_Z_BUFFER,TC,XS,YS

;    if(USE_Z_BUFFER) then begin
;        tvlct,r,g,b,/get
;        img = tvrd()
;        write_png,png_file,img,r,g,b
;    endif else begin
;        if(TC ne 1) then begin
;            tvlct,r,g,b,/get
;            img = tvrd()
;            write_png,png_file,img,r,g,b
;        endif else begin
            snapshot = TVRD(True=1)
            image2D = Color_Quan(snapshot, 1, r, g, b,colors=256)
            write_png, png_file, image2D, r, g, b
;        endelse
;    endelse

	return
	end

