Classe ApngOptions
Summary: 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.
Module: aspose.imaging.imageoptions
Full Name: aspose.imaging.imageoptions.ApngOptions
Inheritance: IMetadataContainer, IHasExifData, IHasMetadata, IHasXmpData, PngOptions
Constructors
| Name | Descrizione |
|---|---|
| ApngOptions() | Inizializza una nuova istanza della classe ApngOptions. |
Properties
| Name | Type | Access | Descrizione |
|---|---|---|---|
| DEFAULT_COMPRESSION_LEVEL [static] | PngCompressionLevel | r | Il livello di compressione predefinito. |
| bit_depth | System.Byte | r/w | Ottiene o imposta i valori di profondità di bit nell’intervallo 1, 2, 4, 8, 16. Tenere presente i seguenti limiti: PngColorType.INDEXED_COLOR supporta una profondità di bit di 1, 2, 4, 8. PngColorType.GRAYSCALE, PngColorType.GRAYSCALE_WITH_ALPHA supportano una profondità di bit di 8. PngColorType.TRUECOLOR, PngColorType.TRUECOLOR_WITH_ALPHA supportano una profondità di bit di 8, 16. |
| buffer_size_hint | int | r/w | Ottiene o imposta il suggerimento della dimensione del buffer, che è definito come dimensione massima consentita per tutti i buffer interni. |
| color_type | PngColorType | r/w | Ottiene o imposta il tipo di colore. |
| compression_level | int | r/w | Ottiene o imposta il livello di compressione del PngImage. |
| default_frame_time | int | r/w | Ottiene o imposta la durata predefinita del fotogramma. |
| eliminato | bool | r | Ottiene un valore che indica se questa istanza è stata eliminata. |
| exif_data | ExifData | r/w | Ottiene o imposta l’istanza Exif. |
| filter_type | PngFilterType | r/w | Ottiene o imposta il tipo di filtro utilizzato durante il processo di salvataggio del file png. |
| full_frame | bool | r/w | Ottiene o imposta un valore che indica se [full frame]. |
| keep_metadata | bool | r/w | Ottiene un valore che indica se mantenere i metadati originali dell’immagine durante l’esportazione. |
| multi_page_options | MultiPageOptions | r/w | Le opzioni multipagina |
| num_plays | int | r/w | Ottiene o imposta il numero di volte per ripetere l’animazione. 0 indica un ciclo infinito. |
| palette | IColorPalette | r/w | Ottiene o imposta la tavolozza dei colori. |
| png_compression_level | PngCompressionLevel | r/w | Ottiene o imposta il livello di compressione del PngImage. |
| progressive | bool | r/w | Ottiene o imposta un valore che indica se un PngImage è progressivo. |
| resolution_settings | ResolutionSetting | r/w | Ottiene o imposta le impostazioni di risoluzione. |
| source | Source | r/w | Ottiene o imposta la sorgente in cui creare l’immagine. |
| vector_rasterization_options | VectorRasterizationOptions | r/w | Ottiene o imposta le opzioni di rasterizzazione vettoriale. |
| xmp_data | XmpPacketWrapper | r/w | Ottiene o imposta i dati Xmp. |
Methods
| Name | Descrizione |
|---|---|
| clone() | Crea una clonazione membro per membro di questa istanza. |
| try_set_metadata(metadata) | Cerca di impostare un’istanza metadata, se questa istanza di Image supporta e implementa l’istanza IImageMetadataFormat. |
Constructor: ApngOptions()
ApngOptions()
Inizializza una nuova istanza della classe ApngOptions.
Property: default_frame_time
Ottiene o imposta la durata predefinita del fotogramma.
See also:
Example # 1: The following example shows how to export apng APNG file format from other no…
Property: num_plays
Ottiene o imposta il numero di volte per ripetere l’animazione.
0 indica un ciclo infinito.
See also:
Example # 1: The following example shows how to export to APNG file format.
Method: clone()
clone()
Crea una clonazione membro per membro di questa istanza.
Returns
| Tipo | Descrizione |
|---|---|
| ImageOptionsBase | Una clonazione membro per membro di questa istanza. |
Method: try_set_metadata(metadata)
try_set_metadata(metadata)
Cerca di impostare un’istanza metadata, se questa istanza di Image supporta e implementa l’istanza IImageMetadataFormat.
Parameters:
| Parametro | Tipo | Descrizione |
|---|---|---|
| metadata | IImageMetadataFormat | I metadati. |
Returns
| Tipo | Descrizione |
|---|---|
| bool | True se metadata non è null e l’istanza di IMetadataContainer supporta e/o implementa l’istanza di IImageMetadataFormat; altrimenti, false. |
Examples
The following example shows how to export to APNG file format.
import aspose.pycore as aspycore
from aspose.imaging import *
from aspose.imaging.imageoptions import *
with Image.load("Animation1.webp") as image:
# Export to APNG animation with unlimited animation cycles as default
image.save("Animation1.webp.png", ApngOptions())
# Setting up animation cycles
obj_init = ApngOptions()
# 5 cycles
obj_init.num_plays = 5
image.save("Animation2.webp.png", obj_init)
The following example shows how to export apng APNG file format from other non-animated multi-page format.
from aspose.imaging import Image
from aspose.imaging.imageoptions import ApngOptions
with Image.load("img4.tif") as image:
# Setting up the default frame duration
obj_init = ApngOptions()
# 500 ms
obj_init.default_frame_time = 500
image.save("img4.tif.500ms.png", obj_init)
obj_init2 = ApngOptions()
# 250 ms
obj_init2.default_frame_time = 250
image.save("img4.tif.250ms.png", obj_init2)