title: Insert an image in Excel through JXL or POI
body: <p>I am stuck in inserting an image into an excel file. The condition is I don't want a full size image to be displayed. The image size is of the regular pixles (1280 * 1024) but in the excel I want to display around 10% of it. If someone double clicks on the image, then the full size image should be displayed. When we get out of the cell, then it should again be of the same size (10%). Any help would be really appreciated.</p>
  
  <pre><code>Workbook wb = new HSSFWorkbook();
     Sheet sheet = wb.createSheet("My Sample Excel");
  
     InputStream inputStream = new FileInputStream("C:/opt/ZZEclipseWorkspace2/WFCLAuto/ScreenShots/12_Mar_2013__09_40_22PM_192.168.30.145.jpeg");
  
     byte[] bytes = IOUtils.toByteArray(inputStream);
  
     int pictureIdx = wb.addPicture(bytes, Workbook.PICTURE_TYPE_PNG);
  
  
     inputStream.close();
  
  
     CreationHelper helper = wb.getCreationHelper();
  
     Drawing drawing = sheet.createDrawingPatriarch();
     ClientAnchor anchor = 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);
  
     FileOutputStream fileOut = null;
     fileOut = new FileOutputStream("C:/opt/ZZEclipseWorkspace2/WFCLAuto/ScreenShots/testing1.xls");
     wb.write(fileOut);
     fileOut.close();
  </code></pre>