PRO multicrop,filter,x1=x1,y1=y1,x2=x2,y2=y2 path=curdir() filelist=file_list(path,filter,/CD) filelist=strip_dirname(filelist) sz=SIZE(filelist) xdim=x2-x1 ydim=y2-y1 test=intarr(xdim,ydim) tvlct,r,g,b,/GET ;path='/bail/d/tdarnell/' FOR i=0, sz(1)-1 DO BEGIN ;{ ;read_gif,filelist(i),img,r,g,b img=readfits(filelist(i),hdu) xcen=fxpar(hdu,'CRPIX1') ycen=fxpar(hdu,'CRPIX2') IF (xcen LT 0) THEN BEGIN print,'Help, I am multi-crapping, center info is invalid' print,'Try looking at img: ',filelist(i) RETURN ENDIF IF (i EQ 0) THEN BEGIN test=img(x1:x2-1,y1:y2-1) tmp_x=xcen tmp_y=ycen ENDIF IF (xcen-tmp_x NE 0) THEN BEGIN x3=x1+(xcen-tmp_x) x4=x2+(xcen-tmp_x) y3=y1+(ycen-tmp_y) y4=y2+(ycen-tmp_y) test=img(x3:x4-1,y3:y4-1) ENDIF $ ELSE test=img(x1:x2-1,y1:y2-1) filename=filelist(i) l=STRLEN(filename) filename=STRMID(filename,0,l-3) filename=filename+'crop.fts' print,'Writing file: '+filename ;write_gif,path+filename,BYTE(test),r,g,b writefits,path+filename,test ENDFOR ;} END