	character*12 c1,c2
        i=iargc()
        if(i.lt.4)then
        write(*,*)
	write(*,*)' Usage: imagec y x ra dec  (4k*4k ccd)'
	write(*,*)'        imagec 2048 2048 19:45:35.6 40:34:24'
        write(*,*)
	stop
        endif
        call getarg(1,c1)
	read(c1(1:),*)y
        call getarg(2,c1)
	read(c1(1:),*)x
        call getarg(3,c1)
        call getarg(4,c2)
	i=itohd1(c1//' '//c2,ra,de)
        if(i.eq.0 .or. x.gt.4096 .or. y.gt.4096)then
	  write(*,*)'input Alpha Delta error!'
	  stop
	endif

        de=de-(2048-y)*1.7*12/15/3600
        ra=ra-(2048-x)*1.7*12/15/3600*cos(de*pi/180)/15
	call toms(ra,c1,1)
	call toms(de,c2,0)
	write(*,*)'Center ==>  ',c1,'  ',c2
	end

	subroutine toms1(aa,c,k)
c hour or degree to char_line
c if k=1 (hour case) in **:**:**.** format
c    k=0 (degree        **:**:**.*  format
c    k=2 (degree)  in  ***:**:**.*  format
	character*12 c
	a=aa
	c(1:1)=' '
	if(a.lt.0.)c(1:1)='-'
	if(a.lt.0.)a=-a
	i=a
	b=(a-i)*60.
	j=b
	x=(b-j)*60.
	if(j.eq.60)then
	j=0
	i=i+1
	endif
	if(k.eq.1)write(c(2:),1)i,j,x
1	format(i2.2,':',i2.2,':',f5.2)
	if(k.eq.0)write(c(2:),2)i,j,x
2       format(i2.2,':',i2.2,':',f4.1)
        if(k.eq.2)write(c(1:),3)i,j,x
3       format(i3.2,':',i2.2,':',f4.1)
	if(c(8:8).eq.' ')c(8:8)='0'
	if(c(9:9).eq.' ')c(9:9)='0'
c solve 60 problem, ex 12:09:00 alway display 12:08:60.0
	if(c(8:8).eq.'6')then
	c(8:8)='0'
	j=j+1
	write(c(5:6),'(i2.2)')j
	if(c(5:5).eq.'6')then
	c(5:5)='0'
	i=i+1
	if(k.ne.2)write(c(2:3),'(i2.2)')i
	if(k.eq.2)write(c(1:3),'(i3.2)')i
	endif
	endif
	end


	function itohd1(cc,alpha,delta)
c 12:23 -23:00:2.3 1950 in a char_line, give value to 3 avariable
c 12:23 -23:00:2.3       is also ok, but last avariable get zero value
c 12:34:23.5 to 12.578567
	character*(*) cc
	character*20 dd
	byte bell
	bell=7
	itohd1=1
	k1=index(cc,' ')
	k2=index(cc,',')
	k=min(k1,k2)
	if(k1.eq.0)k=k2
	if(k2.eq.0)k=k1
	if(k.lt.2.or.k.gt.13)goto 100
	dd=cc(1:k)
	do 10 i=1,9
10	if(dd(i:i).eq.':')dd(i:i)=','
	x=0
	y=0
	z=0	
	read(dd(1:),*,end=15,err=100)x,y,z
15	alpha=x+y/60.+z/3600.
	do 16 i=k+1,k+6
	if(cc(i:i).ne.' ')goto 17
16	continue
	goto 100
17	dd=cc(i:)
	k1=index(dd,' ')
	k2=index(dd,',')
	k=min(k1,k2)
	if(k1.eq.0)k=k2
	if(k2.eq.0)k=k1
	do 20 i=1,k
20	if(dd(i:i).eq.':')dd(i:i)=','
	x=0
	y=0
	z=0
	read(dd(1:K),*,end=30,err=100)x,y,z
30	if(x.lt.0.)x=-x
	delta=x+y/60.+z/3600.
	if(index(cc,'-').ne.0)delta=-delta
	return
100	itohd1=0
	write(*,'(1x,a1)')bell
	end

