public final class ApngImage extends RasterCachedMultipageImage
The animated PNG image.
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 }
Constructor and Description |
---|
ApngImage(ApngOptions options,
int width,
int height)
Initializes a new instance of the
ApngImage class. |
Modifier and Type | Method and Description |
---|---|
ApngFrame |
addFrame()
Adds new frame to the end of the own frame collection.
|
void |
addFrame(RasterImage frameImage)
Adds new frame to the end of the own frame collection.
|
void |
addFrame(RasterImage frameImage,
long frameTime)
Adds new frame to the end of the own frame collection.
|
long |
getDefaultFrameTime()
Gets the default frame duration.
|
Image |
getDefaultPage()
Gets the default page.
|
long |
getFileFormat()
Gets a value of file format
|
boolean |
getInterlaced()
Gets a value indicating whether this
PngImage is interlaced. |
int |
getNumPlays()
Gets the number of times to loop animation.
|
int |
getPageCount()
Gets the page count.
|
PageExportingAction |
getPageExportingAction()
Gets the page exporting action.
|
Image[] |
getPages()
Gets the pages.
|
XmpPacketWrapper |
getXmpData()
Gets the XMP metadata.
|
ApngFrame |
insertFrame(int index)
Inserts new frame into the own frame collection at the specified index.
|
void |
insertFrame(int index,
RasterImage frameImage)
Inserts new frame into the own frame collection at the specified index.
|
void |
insertFrame(int index,
RasterImage frameImage,
long frameTime)
Inserts new frame into the own frame collection at the specified index.
|
ApngFrame |
popFrameAt(int index)
Removes and returns the frame at the specified index of the own frame collection.
|
void |
removeAllFrames()
Removes all frames from the own frame collection.
|
void |
removeFrameAt(int index)
Removes the frame at the specified index of the own frame collection.
|
void |
resetDefaultImage()
Deletes a previously set default image.
|
void |
setDefaultFrameTime(long value)
Sets the default frame duration.
|
void |
setDefaultImage(RasterImage image)
Sets the specified raster image as the default image of the current animation.
|
void |
setNumPlays(int value)
Sets the number of times to loop animation.
|
void |
setPageExportingAction(PageExportingAction value)
Sets the page exporting action.
|
void |
setXmpData(XmpPacketWrapper value)
Sets the XMP metadata.
|
adjustBrightness, adjustContrast, adjustGamma, adjustGamma, binarizeBradley, binarizeBradley, binarizeFixed, binarizeOtsu, cacheData, crop, crop, dither, filter, getBackgroundColor, getBitsPerPixel, getHeight, getImageOpacity, getWidth, grayscale, hasAlpha, hasTransparentColor, isCached, normalizeAngle, replaceColor, replaceNonTransparentColors, resize, resize, resizeHeightProportionally, resizeWidthProportionally, rotate, rotateFlip, rotateFlipAll, setBackgroundColor
dither, getArgb32Pixel, getDefaultArgb32Pixels, getDefaultPixels, getDefaultRawData, getDefaultRawData, getHorizontalResolution, getModifyDate, getPixel, getPremultiplyComponents, getRawCustomColorConverter, getRawDataFormat, getRawDataSettings, getRawFallbackIndex, getRawIndexedColorConverter, getRawLineSize, getSkewAngle, getTransparentColor, getUpdateXmpData, getUseRawData, getVerticalResolution, isRawDataAvailable, loadArgb32Pixels, loadArgb64Pixels, loadCmyk32Pixels, loadCmykPixels, loadPartialArgb32Pixels, loadPartialPixels, loadPixels, loadRawData, loadRawData, normalizeAngle, readArgb32ScanLine, readScanLine, replaceColor, replaceNonTransparentColors, rotate, saveArgb32Pixels, saveCmyk32Pixels, saveCmykPixels, savePixels, saveRawData, setArgb32Pixel, setHorizontalResolution, setPalette, setPixel, setPremultiplyComponents, setRawCustomColorConverter, setRawFallbackIndex, setRawIndexedColorConverter, setResolution, setTransparentColor, setTransparentColor, setUpdateXmpData, setUseRawData, setVerticalResolution, toBitmap, writeArgb32ScanLine, writeScanLine
canLoad, canLoad, canLoad, canLoad, canSave, create, getBounds, getBufferSizeHint, getContainer, getDefaultOptions, getFileFormat, getFileFormat, getFittingRectangle, getFittingRectangle, getInterruptMonitor, getOriginalOptions, getPalette, getProgressEventHandler, getProgressEventHandlerInfo, getProportionalHeight, getProportionalWidth, getSize, hasBackgroundColor, isAutoAdjustPalette, load, load, load, load, load, load, resize, resizeHeightProportionally, resizeHeightProportionally, resizeWidthProportionally, resizeWidthProportionally, save, save, save, save, save, save, save, setAutoAdjustPalette, setBackgroundColor, setBufferSizeHint, setInterruptMonitor, setPalette
getDataStreamContainer, save, save, save, save
close, dispose, getDisposed
public ApngImage(ApngOptions options, int width, int height)
Initializes a new instance of the ApngImage
class.
options
- The options.width
- The width.height
- The height.public long getFileFormat()
Gets a value of file format
getFileFormat
in class Image
public XmpPacketWrapper getXmpData()
Gets the XMP metadata.
getXmpData
in class RasterCachedMultipageImage
public void setXmpData(XmpPacketWrapper value)
Sets the XMP metadata.
setXmpData
in class RasterCachedMultipageImage
value
- the XMP metadata.public int getPageCount()
Gets the page count.
getPageCount
in interface IMultipageImage
getPageCount
in class RasterCachedMultipageImage
public Image[] getPages()
Gets the pages.
getPages
in interface IMultipageImage
getPages
in class RasterCachedMultipageImage
public Image getDefaultPage()
Gets the default page.
getDefaultPage
in interface IMultipageImage
getDefaultPage
in class RasterCachedMultipageImage
public final int getNumPlays()
Gets the number of times to loop animation. 0 indicates infinite looping.
public final void setNumPlays(int value)
Sets the number of times to loop animation. 0 indicates infinite looping.
value
- the number of times to loop animation.public final long getDefaultFrameTime()
Gets the default frame duration. Used when creating new frames.
public final void setDefaultFrameTime(long value)
Sets the default frame duration. Used when creating new frames.
value
- the default frame duration, in milliseconds.public final boolean getInterlaced()
Gets a value indicating whether this PngImage
is interlaced.
PngImage
is interlaced.public PageExportingAction getPageExportingAction()
Gets the page exporting action. Please note that setting this method will automatically release page resources after it is executed. It will be executed just before each page is saved.
getPageExportingAction
in interface IMultipageImage
getPageExportingAction
in class RasterCachedMultipageImage
public void setPageExportingAction(PageExportingAction value)
Sets the page exporting action. Please note that setting this method will automatically release page resources after it is executed. It will be executed just before each page is saved.
setPageExportingAction
in interface IMultipageImage
setPageExportingAction
in class RasterCachedMultipageImage
value
- the page exporting action.public final ApngFrame addFrame()
Adds new frame to the end of the own frame collection. A new frame will be created according to the size of the current image.
public final void addFrame(RasterImage frameImage)
Adds new frame to the end of the own frame collection. The contents of the new frame will be filled from the specified image.
frameImage
- The frame image.com.aspose.ms.System.ArgumentNullException
- frameImage is null.public final void addFrame(RasterImage frameImage, long frameTime)
Adds new frame to the end of the own frame collection. The contents of the new frame will be filled from the specified image.
frameImage
- The frame image.frameTime
- The frame duration, in milliseconds.com.aspose.ms.System.ArgumentNullException
- frameImage is null.public final ApngFrame insertFrame(int index)
Inserts new frame into the own frame collection at the specified index. A new frame will be created according to the size of the current image.
index
- The index.com.aspose.ms.System.ArgumentOutOfRangeException
- index
is less than 0.
or
index
is greater than PageCount
(RasterCachedMultipageImage.getPageCount()
).public final void insertFrame(int index, RasterImage frameImage)
Inserts new frame into the own frame collection at the specified index. The contents of the new frame will be filled from the specified image.
index
- The index.frameImage
- The frame image.com.aspose.ms.System.ArgumentOutOfRangeException
- index
is less than 0.
or
index
is greater than PageCount
(RasterCachedMultipageImage.getPageCount()
).com.aspose.ms.System.ArgumentNullException
- frameImage is null.public final void insertFrame(int index, RasterImage frameImage, long frameTime)
Inserts new frame into the own frame collection at the specified index. The contents of the new frame will be filled from the specified image.
index
- The index.frameImage
- The frame image.frameTime
- The frame duration, in milliseconds.com.aspose.ms.System.ArgumentOutOfRangeException
- index
is less than 0.
or
index
is greater than PageCount
(RasterCachedMultipageImage.getPageCount()
).com.aspose.ms.System.ArgumentNullException
- frameImage is null.public final ApngFrame popFrameAt(int index)
Removes and returns the frame at the specified index of the own frame collection.
index
- The index.com.aspose.ms.System.ArgumentOutOfRangeException
- index
is less than 0.
or
index
is equal to or greater than PageCount
(RasterCachedMultipageImage.getPageCount()
).public final void removeFrameAt(int index)
Removes the frame at the specified index of the own frame collection. The frame to be deleted will be disposed.
index
- The index.com.aspose.ms.System.ArgumentOutOfRangeException
- index
is less than 0.
or
index
is equal to or greater than PageCount
(RasterCachedMultipageImage.getPageCount()
).public final void removeAllFrames()
Removes all frames from the own frame collection.
public final void setDefaultImage(RasterImage image)
Sets the specified raster image as the default image of the current animation.
image
- The image.com.aspose.ms.System.ArgumentNullException
- image is null.public final void resetDefaultImage()
Deletes a previously set default image. After this, the default image is the first frame in the own frame collection (it cannot be deleted using this method).
Copyright (c) 2008-2020 Aspose Pty Ltd. All Rights Reserved.