import java.io.*;
import java.util.*;
import javax.swing.*;

import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.hssf.util.*;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.ss.util.*;
import org.apache.poi.util.IOUtils;

public class apachePOI10 {

    public static void main(String[] args) {
   Workbook wb = new HSSFWorkbook();
   Sheet sheet = wb.createSheet("My Sample Excel");
   InputStream inputStream=null;
   try{
   inputStream = new FileInputStream("fall.jpg");
   }catch (FileNotFoundException e) {e.printStackTrace();}
   int pictureIdx=0;
 try{
    byte[] bytes = IOUtils.toByteArray(inputStream);
   pictureIdx = wb.addPicture(bytes, Workbook.PICTURE_TYPE_PNG);
   inputStream.close();
   }catch (IOException e1) {e1.printStackTrace();}
   CreationHelper helper = wb.getCreationHelper();
   Drawing drawing = sheet.createDrawingPatriarch();
   ClientAnchor anchor;
   anchor=new HSSFClientAnchor(0,0,0,255,(short)1,2,(short)7,10);
    anchor.setAnchorType(2);
    //= helper.createClientAnchor();
   //set top-left corner for the image
   anchor.setCol1(1);
   anchor.setRow1(2);
   Picture pict = drawing.createPicture(anchor, pictureIdx);
   pict.resize(0.1);
   try{
   FileOutputStream fileOut = new FileOutputStream("picture.xls");
   wb.write(fileOut);
   fileOut.close();
   }catch (FileNotFoundException e) {e.printStackTrace();}
    catch (IOException e1) {e1.printStackTrace();}

}
}