public class ApngOptions extends PngOptions
The API for Animated PNG (Animated Portable Network Graphics) image file format creation is a dynamic tool for developers seeking to generate captivating animated images. With customizable options such as frame duration and the number of times to loop, this API allows for fine-tuning animated content according to specific needs. Whether creating engaging web graphics or interactive visuals, you can leverage this API to seamlessly incorporate APNG images with precise control over animation parameters.
The following example shows how to export to APNG file format.
import com.aspose.imaging;
import com.aspose.imaging.imageoptions;
try (Image image = Image.load("Animation1.webp"))
{
// Export to APNG animation with unlimited animation cycles as default
image.save("Animation1.webp.png", new ApngOptions());
// Setting up animation cycles
ApngOptions options = new ApngOptions();
options.setNumPlays(5);
image.save("Animation2.webp.png", options); // 5 cycles
}
DEFAULT_COMPRESSION_LEVEL| Constructor and Description |
|---|
ApngOptions()
Initializes a new instance of the
ApngOptions class. |
ApngOptions(ApngOptions apngOptions)
Initializes a new instance of the
ApngOptions class. |
| Modifier and Type | Method and Description |
|---|---|
long |
getDefaultFrameTime()
Gets the default frame duration.
|
int |
getNumPlays()
Gets the number of times to loop animation.
|
void |
setDefaultFrameTime(long value)
Sets the default frame duration.
|
void |
setNumPlays(int value)
Sets the number of times to loop animation.
|
getBitDepth, getColorType, getCompressionLevel, getFilterType, getPngCompressionLevel, getProgressive, setBitDepth, setColorType, setCompressionLevel, setFilterType, setPngCompressionLevel, setProgressivedeepClone, getBufferSizeHint, getFullFrame, getMultiPageOptions, getPalette, getProgressEventHandler, getResolutionSettings, getSource, getVectorRasterizationOptions, getXmpData, isKeepMetadata, setBufferSizeHint, setFullFrame, setKeepMetadata, setMultiPageOptions, setPalette, setProgressEventHandler, setResolutionSettings, setSource, setVectorRasterizationOptions, setXmpDataclose, dispose, getDisposedpublic ApngOptions()
Initializes a new instance of the ApngOptions class.
public ApngOptions(ApngOptions apngOptions)
Initializes a new instance of the ApngOptions class.
apngOptions - The PNG options.public final int getNumPlays()
Gets the number of times to loop animation. 0 indicates infinite looping.
The following example shows how to export to APNG file format.
import com.aspose.imaging;
import com.aspose.imaging.imageoptions;
try (Image image = Image.load("Animation1.webp"))
{
// Export to APNG animation with unlimited animation cycles as default
image.save("Animation1.webp.png", new ApngOptions());
// Setting up animation cycles
ApngOptions options = new ApngOptions();
options.setNumPlays(5);
image.save("Animation2.webp.png", options); // 5 cycles
}
public final void setNumPlays(int value)
Sets the number of times to loop animation. 0 indicates infinite looping.
The following example shows how to export to APNG file format.
import com.aspose.imaging;
import com.aspose.imaging.imageoptions;
try (Image image = Image.load("Animation1.webp"))
{
// Export to APNG animation with unlimited animation cycles as default
image.save("Animation1.webp.png", new ApngOptions());
// Setting up animation cycles
ApngOptions options = new ApngOptions();
options.setNumPlays(5);
image.save("Animation2.webp.png", options); // 5 cycles
}
public final long getDefaultFrameTime()
Gets the default frame duration.
public final void setDefaultFrameTime(long value)
Sets the default frame duration.
Copyright (c) 2008-2025 Aspose Pty Ltd. All Rights Reserved.