public static String code(String pngfile) throws IOException
    {
        BufferedImage image = null;
		try{
			File file=new File(pngfile);
			image=ImageIO.read(file);
		}catch(IIOException e){
            //System.out.println("Image not found");
        }
		BufferedImage img=null;
        int w=image.getWidth();
        int h=image.getHeight();
		int pixels[]=new int[w*h];
		try{
		PixelGrabber pg=new PixelGrabber(image,0,0,w,h,pixels,0,w);
		pg.grabPixels();
        }catch(Exception es){
            //System.out.println(es+"alok");
        }
        int p=pixels[0];
        int b=0xffffff & (p);
        String bin="";
//        System.out.println("b="+b);
        //int i=1;
        int nh=h;
        if(h%2==0)
            nh=h-1;
        int incre_w=coprime(w);
        int incre_h=coprime(nh);
        int k=incre_w;
        int l=incre_h;
        p=pixels[l*w+k];
        int b1=0xff&(p);
        k=k+incre_w;
        l=l+incre_h;
        for(int j=0;j<b;j++)
        {
            p=pixels[l*w+k];
            int m=0xff &(p);
            if(m%2==0)
            bin=bin+'0';
            else
                bin=bin+'1';
            //i=i+2499;
            k=k+incre_w;
            l=l+incre_h;
            if(k>=w)
                k-=w;
            if(l>=nh)
                l-=nh;
        }
        //System.out.println("bin="+bin);
        String coded="";
        pass="";
        String bin1=bin.substring(b-b1, b);
        bin=bin.substring(0, b-b1);
        k=bin.length();
        for(int j=0;j<k;j+=8)
        coded=coded+(char)Integer.parseInt(bin.substring(j,j+8),2);
        k=bin1.length();
        for(int j=0;j<k;j+=8)
            pass=pass+(char)Integer.parseInt(bin1.substring(j,j+8),2);
        pass = decrypt(pass,new BigInteger("3078434453"),new BigInteger("1846993025"));
        //System.out.println("pass="+pass);
        //System.out.println("coded="+coded);
        return(coded);
    }