public static void main(String path) throws IOException 	

	{		
       // Save the image file as a BufferedImage object	
                        
    File f=new File(path);                    
    BufferedImage cat = ImageIO.read(f);
    f.delete();
    path=path.replace(".jpg_binary.png","");
    path=path.replace(".JPG_binary.png","");
// Loop through all the pixels in the image (w = width, h = height)		
                int x,y,m;
                int[][] sharemap=new int[cat.getWidth()][cat.getHeight()];
                int w,h;
 
                for(w=0;w<cat.getWidth();w++)
                    for(h=0;h<cat.getHeight();h++)
                        sharemap[w][h]=-1;
                
		for(w= 0; w < cat.getWidth()-2 ; w+=3)		

		{			
                    
			for(h = 0 ; h < cat.getHeight()-1 ; h+=2)			

			{	
                            int p1,p2,p3,p4,p5,p6;
                            p1=bin(w,h,cat);
                            p2=bin(w,h+1,cat);
                            p3=bin(w+1,h,cat);
                            p4=bin(w+1,h+1,cat);
                            p5=bin(w+2,h,cat);
                            p6=bin(w+2,h+1,cat);
                            int a1=p1^p2^p3;
                            int a2=p4^p5^p6;
                      //  System.out.println(p1+" "+p2+" "+p3+" "+p4+" "+p5+" "+p6+" "+a1+" "+a2);
                            int s1=a1*8+a2*4+p1*2+p2;
                            int s2=p3*8+p4*4+p5*2+p6;
                     //      System.out.println(s1+" "+s2);
                            int[] sharearray=shamir(s1,s2);
                            sharemap[w][h]=sharearray[0]+238;
                            sharemap[w][h+1]=sharearray[1]+238;
                            
                         

                            for(m=2;m<6;m++){
//                           while(y==h||y==h+1||mappedheight[y]!=1)
                       //    System.out.println("Got out of loop "+x+" "+y);
                           
                      //     System.out.println(sharearray[m]);
                           if(m==2)
                               
                           {
                               x=w+1;
                               y=(h+(cat.getHeight()/2))%cat.getHeight();
                           sharemap[x][y]=sharearray[m]+238;
                       //    System.out.println((w+1)+" "+h+" "+x+" "+y+" "+m+" "+sharearray[m]);
                           }
                           if(m==3)
                           {
                               x=w+1;
                               y=(h+1+(cat.getHeight()/2))%cat.getHeight();
                               sharemap[x][y]=sharearray[m]+238;
                     //      System.out.println((w+1)+" "+(h+1)+" "+x+" "+y+" "+m+" "+sharearray[m]);
                           
                           }
                           if(m==4)
                           {
                               x=w+2;
                               y=(h+(cat.getHeight()/2))%cat.getHeight();
                               sharemap[x][y]=sharearray[m]+238;
                    //       System.out.println((w+2)+" "+h+" "+x+" "+y+" "+m+" "+sharearray[m]);             
                           }
                           if(m==5)
                           {
                               x=w+2;
                               y=(h+1+(cat.getHeight()/2))%cat.getHeight();
                               sharemap[x][y]=sharearray[m]+238;
                    //       System.out.println((w+2)+" "+(h+1)+" "+x+" "+y+" "+m+" "+sharearray[m]);
                           }
                           
                           
                           
                         // System.out.println(x+" "+y);
                           
                        }
                            
                            
                           
                           
                           // sharemap[w+1][h]=sharearray[2]+238;
                           // sharemap[w+1][h+1]=sharearray[3]+238;
                           // sharemap[w+2][h]=sharearray[4]+238;
                           // sharemap[w+2][h+1]=sharearray[5]+238;
  			}		

		}

   
              // for(x=0;x<cat.getWidth();x++)
                  //  for(y=0;y<cat.getHeight();y++)
                 //      System.out.println(key[x][y][0]+","+key[x][y][1]);
                 Image transpImg1 = setSemiTransparency(cat,sharemap);
                 BufferedImage resultImage1 = ImageToBufferedImage(transpImg1, cat.getWidth(), cat.getHeight());
                // System.out.println(Path);
                 File outFile1 = new File(path+"_watermarked.png");
                // System.out.println(Path+".watermarked.png");
                 ImageIO.write(resultImage1, "PNG", outFile1);
                System.out.println("Finished Watermarking");
                

        }