	character*80 f1,head(72)
        real a(2048,2048)
	real b(512,512)
	call getarg(1,f1)         
        i=lnblnk(f1)
	f1(i+1:i+1)=char(0)
	open(52,file=f1,status='old',access='direct',recl=5760)
	read(52,rec=1)head
	close(52)
	call readfits(f1,a,n1,n2)
	f1(1:1)='A'
	head(4)(24:30)='    512'
	head(5)(24:30)='    512'
	open(52,file=f1,status='unknown',access='direct',recl=5760)
	write(52,rec=1)head
	close(52)
	do 10 i=1,512
	do 10 j=1,512
10	b(i,j)=a(i*4,j*4)
	n1=512
	n2=512
	call swap4(b,n1*n2*4)
	call tvwrite(f1,b,n1*n2*4,5760)
	write(*,*)'   ok!'
	end
