Free Support Forum - aspose.com

Create Shape Thumbnail Image

Hi,

Am evaluating Aspose.Slide for Java and is trying to create Shape thumbnail image(jpeg).
For this , am using the getThumbnail method as advised in this wiki link:
http://www.aspose.com/wiki/default.aspx/Aspose.Slides/CreatingShapesThumbnail.html

But what i get is only blank white images. Please look into this and provide a solution.

P.S: I have Aspose Metafiles in Classpath.

Regards
Vijay

Dear Vijay,

I have attached the Java code which shows how to include certain shapes in the thumbnail image of slide.

In my example code, I am taking the thumbnail image of slide which has different shapes, but I want to render only circles in the output image.

The idea behind is to implement IDrawingControl interface, which has the checkObject method.

The Slide.getThumbnail calls this method for each shape, if you say yes, it will draw in thumbnail, if you say no, it will not draw it.

So whatever shape you want to draw, save it in your list (in my case I used HashMap) and during the checkObject, if it is in your list, then return DRAW else return IGNORE

For clarification, please see the attached code.

I have also included the source presentation used in this code and output thumbnail image for you to view.

Hi,



Thanks for your code . I believe i did not make my requirement clear.



Using your code we can generate the image of the slide with desired
shapes. My requirement is to convert the shape to image directly i.e
get a rectangle shape as a JPEG image. Can this be done ?

Please provide a solution for this.



Regards

Vijay

Let me figure it out.

Please try this code, the code is almost like the previous code, but now I am drawing a portion of slide via thumbnail method

Rectangle2D.Float rect=new Rectangle2D.Float(shp.getX()-50,shp.getY()-50,shp.getWidth()+50,shp.getHeight()+50);

BufferedImage img=srcSld.getThumbnail(1,1, rect,drawingControl);

Hi,

Thanks for the code. Am able to convert the shapes to images. but the converted image is not transparent i.e it contains a white background. What are the options i should set to get a transparent image ?

Regards
Vijay

Hi team,

Am still waiting for the answer for my question ?
Can anyone reply , i badly need to know a way to convert the shape to a transparent image.

Regards
Vijay

I have forwarded your question to technical team. As soon as, I get the reply, I will post here.

Dear Vijay,

No, it is not possible, you cannot get image of shape with transparent background. Image of single shape is just a region of the whole slide so
it also has white background.