Drawing — Aspose.Slides FOSS for Java API Reference

Aspose.Slides FOSS for Java provides several drawing-related utility types for working with images and geometric points.

Package: org.aspose.slides.foss

import org.aspose.slides.foss.*;

Images (Factory)

The Images class provides static factory methods to create IImage instances.

public class Images

Methods

MethodReturnsDescription
Images.fromFile(String path)IImageLoad an image from a file path.
Images.fromStream(InputStream stream)IImageLoad an image from an input stream.
Images.fromBytes(byte[] data)IImageCreate an image from a byte array.

Image (IImage)

The Image class represents a decoded image. It implements IImage.

Properties

PropertyTypeDescription
getWidth()intImage width in pixels.
getHeight()intImage height in pixels.
getContentType()StringMIME content type.

PPImage (IPPImage)

The PPImage class represents an image embedded in a presentation. It implements IPPImage.

Properties

PropertyTypeDescription
getImage()IImageThe underlying image data.
getContentType()StringMIME content type.

PointF

The PointF class represents a point with float coordinates, used for comment positions.

Constructor

SignatureDescription
PointF(float x, float y)Creates a point at (x, y).

Properties

PropertyTypeDescription
getX()floatX coordinate.
getY()floatY coordinate.

Usage Examples

Load and Embed an Image

import org.aspose.slides.foss.*;

Presentation prs = new Presentation();
IImage img = Images.fromFile("photo.png");
IPPImage ppImg = prs.getImages().addImage(img);

ISlide slide = prs.getSlides().get(0);
slide.getShapes().addPictureFrame(
    ShapeType.RECTANGLE, 50, 50, 300, 200, ppImg);

prs.save("with-image.pptx", SaveFormat.PPTX);

See Also