Team,
Hi Anbu,
Thanks for your inquiry.
Anbu2Win:
Original image is saved instead of cropped image.
It would be great if you please share some more detail about your query. We will then provide you more information on this along with code.
The Shape.getShapeRenderer method creates and returns an object that can be used to render this shape into an image. Please also check ShapeRenderer. renderToScale and ShapeRenderer. renderToSize method from here:
Hi Anbu,
Thanks for your inquiry. The crop tool in Microsoft Word can only trim/remove unwanted portions of pictures to get just the look that you want to make. Cropping doesn’t actually modify the original picture; instead, it just hides a part of a picture.
In your case, the image is actually stored inside a Shape node and you can always access the actual (full) image using the ToByteArray , ToImage or Save methods. If the image is stored inside the shape, you can also directly access it using the ImageBytes property.
However, please note that the cropping effect is made only on the Shape node but not on the actual image. Therefore, if you want to render the cropped Shape, please use ShapeRenderer class.
Best regards,
Hi,
Hi ,
Document doc = new Document(“C:\Temp\crop.doc”);
Shape shape = (Shape) doc.selectNodes("//Shape").get(0);
// to get the cropped shape
shape.getShapeRenderer().save(“C:\Temp\outCropped.png”, new ImageSaveOptions(SaveFormat.PNG));
//to get the actual image
shape.getImageData().save(“C:\Temp\outOriginal.png”);
Thanks Awais Hafeez. It is working now.