Hello Team,
Could you guys please let me know how can I change image height/width before adding it to Rectangle shape? We’ve images of random sizes and need approach to expand/shrink images height/width before adding those to rectangle shape without losing their quality. Currently I am using below code in which I am using “PictureFillMode.Stretch” option to fit image but it’s kind of reducing image quality.
IShape shp = sld.getShapes().addAutoShape(ShapeType.Rectangle, 540, 10, 170, 60);
//shp.getFillFormat().getSolidFillColor().setColor(Color.WHITE);
//Set the fill type to Picture
shp.getFillFormat().setFillType(FillType.Picture);
//Set the picture fill mode
shp.getFillFormat().getPictureFillFormat().setPictureFillMode(PictureFillMode.Stretch);
//Set the picture
IPPImage imgx = null;
try {
imgx = pres.getImages().addImage(new FileInputStream(new File("Logo.jpg")));
} catch (IOException e) {
}
shp.getFillFormat().getPictureFillFormat().getPicture().setImage(imgx);
Please advise!
Regards,
Pavan