Class ApngOptions

Class ApngOptions

이름 공간 : Aspose.Imaging.ImageOptions 모임: Aspose.Imaging.dll (25.4.0)

애니메이션 PNG (Animated Portable Network Graphics) 이미지 파일 형식창조는 개발자가 매혹을 생성하기 위해 노력하는 역동적 인 도구입니다.애니메이션 이미지. 프레임 기간과 같은 사용자 지정 옵션과 함께롤할 때의 수, 이 API는 얇게 톤화 된 애니메이션 콘텐츠를 허용합니다.특정 요구 사항에 따라. 흥미 진진한 웹 그래픽을 만들거나상호 작용하는 시각, 이 API를 사용하여 무조건 통합할 수 있습니다.APNG 이미지는 애니메이션 매개 변수에 대한 정확한 제어를 제공합니다.

public class ApngOptions : PngOptions, IDisposable, IHasXmpData, IHasMetadata, ICloneable

Inheritance

object DisposableObject ImageOptionsBase PngOptions ApngOptions

Implements

IDisposable , IHasXmpData , IHasMetadata , ICloneable

상속 회원들

PngOptions.DefaultCompressionLevel , PngOptions.ColorType , PngOptions.Progressive , PngOptions.FilterType , PngOptions.CompressionLevel , PngOptions.BitDepth , ImageOptionsBase.Clone() , ImageOptionsBase.ReleaseManagedResources() , ImageOptionsBase.KeepMetadata , ImageOptionsBase.XmpData , ImageOptionsBase.Source , ImageOptionsBase.Palette , ImageOptionsBase.ResolutionSettings , ImageOptionsBase.VectorRasterizationOptions , ImageOptionsBase.BufferSizeHint , ImageOptionsBase.MultiPageOptions , ImageOptionsBase.FullFrame , ImageOptionsBase.ProgressEventHandler , DisposableObject.Dispose() , DisposableObject.ReleaseManagedResources() , DisposableObject.ReleaseUnmanagedResources() , DisposableObject.VerifyNotDisposed() , DisposableObject.Disposed , object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Examples

다음 예제는 다른 비 애니메이션 멀티 페이지 형식에서 APNG 파일 형식을 수출하는 방법을 보여줍니다.

using Aspose.Imaging;
                                                                                                                     using Aspose.Imaging.ImageOptions;

                                                                                                                     using (Image image = Image.Load("img4.tif")) {
                                                                                                                         // Setting up the default frame duration
                                                                                                                         image.Save("img4.tif.500ms.png", new ApngOptions() { DefaultFrameTime = 500 }); // 500 ms
                                                                                                                         image.Save("img4.tif.250ms.png", new ApngOptions() { DefaultFrameTime = 250 }); // 250 ms
                                                                                                                     }

다음 예제는 APNG 파일 형식으로 수출하는 방법을 보여줍니다.

using Aspose.Imaging;
                                                                         using Aspose.Imaging.ImageOptions;

                                                                         using (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
                                                                             image.Save("Animation2.webp.png", new ApngOptions() { NumPlays = 5 }); // 5 cycles
                                                                         }

다음 예제는 다른 라스터 단일 페이지 이미지에서 APNG 이미지를 만드는 방법을 보여줍니다.

using Aspose.Imaging;
                                                                                                      using Aspose.Imaging.ImageOptions;
                                                                                                      using Aspose.Imaging.FileFormats.Apng;

                                                                                                      const int AnimationDuration = 1000; // 1 s
                                                                                                      const int FrameDuration = 70; // 70 ms
                                                                                                      using (RasterImage sourceImage = (RasterImage)Image.Load("not_animated.png"))
                                                                                                      {
                                                                                                          ApngOptions createOptions = new ApngOptions
                                                                                                          {
                                                                                                              Source = new FileCreateSource("raster_animation.png", false),
                                                                                                              DefaultFrameTime = (uint)FrameDuration,
                                                                                                              ColorType = PngColorType.TruecolorWithAlpha,
                                                                                                          };

                                                                                                          using (ApngImage apngImage = (ApngImage)Image.Create(
                                                                                                              createOptions,
                                                                                                              sourceImage.Width,
                                                                                                              sourceImage.Height))
                                                                                                          {
                                                                                                              // It is possible to set image default frame time there: apngImage.DefaultFrameTime = (uint)FrameDuration;

                                                                                                              int numOfFrames = AnimationDuration / FrameDuration;
                                                                                                              int numOfFrames2 = numOfFrames / 2;

                                                                                                              // Cleaning because the image contains one frame by default
                                                                                                              apngImage.RemoveAllFrames();

                                                                                                              // add first frame
                                                                                                              apngImage.AddFrame(sourceImage);

                                                                                                              // add intermediate frames
                                                                                                              for (int frameIndex = 1; frameIndex < numOfFrames - 1; ++frameIndex)
                                                                                                              {
                                                                                                                  apngImage.AddFrame(sourceImage);
                                                                                                                  ApngFrame lastFrame = (ApngFrame)apngImage.Pages[apngImage.PageCount - 1];
                                                                                                                  float gamma = frameIndex >= numOfFrames2 ? numOfFrames - frameIndex - 1 : frameIndex;
                                                                                                                  lastFrame.AdjustGamma(gamma);
                                                                                                              }

                                                                                                              // add last frame
                                                                                                              apngImage.AddFrame(sourceImage);

                                                                                                              apngImage.Save();
                                                                                                          }
                                                                                                      }

Constructors

ApngOptions()

Aspose.Imaging.ImageOptions.ApngOptions 클래스의 새로운 예를 시작합니다.

public ApngOptions()

Properties

DefaultFrameTime

가져오거나 기본 프레임 기간을 설정합니다.

public uint DefaultFrameTime { get; set; }

부동산 가치

uint

Examples

다음 예제는 다른 비 애니메이션 멀티 페이지 형식에서 APNG 파일 형식을 수출하는 방법을 보여줍니다.

using Aspose.Imaging;
                                                                                                                     using Aspose.Imaging.ImageOptions;

                                                                                                                     using (Image image = Image.Load("img4.tif")) {
                                                                                                                         // Setting up the default frame duration
                                                                                                                         image.Save("img4.tif.500ms.png", new ApngOptions() { DefaultFrameTime = 500 }); // 500 ms
                                                                                                                         image.Save("img4.tif.250ms.png", new ApngOptions() { DefaultFrameTime = 250 }); // 250 ms
                                                                                                                     }

다음 예제는 다른 라스터 단일 페이지 이미지에서 APNG 이미지를 만드는 방법을 보여줍니다.

using Aspose.Imaging;
                                                                                                      using Aspose.Imaging.ImageOptions;
                                                                                                      using Aspose.Imaging.FileFormats.Apng;

                                                                                                      const int AnimationDuration = 1000; // 1 s
                                                                                                      const int FrameDuration = 70; // 70 ms
                                                                                                      using (RasterImage sourceImage = (RasterImage)Image.Load("not_animated.png"))
                                                                                                      {
                                                                                                          ApngOptions createOptions = new ApngOptions
                                                                                                          {
                                                                                                              Source = new FileCreateSource("raster_animation.png", false),
                                                                                                              DefaultFrameTime = (uint)FrameDuration,
                                                                                                              ColorType = PngColorType.TruecolorWithAlpha,
                                                                                                          };

                                                                                                          using (ApngImage apngImage = (ApngImage)Image.Create(
                                                                                                              createOptions,
                                                                                                              sourceImage.Width,
                                                                                                              sourceImage.Height))
                                                                                                          {
                                                                                                              // It is possible to set image default frame time there: apngImage.DefaultFrameTime = (uint)FrameDuration;

                                                                                                              int numOfFrames = AnimationDuration / FrameDuration;
                                                                                                              int numOfFrames2 = numOfFrames / 2;

                                                                                                              // Cleaning because the image contains one frame by default
                                                                                                              apngImage.RemoveAllFrames();

                                                                                                              // add first frame
                                                                                                              apngImage.AddFrame(sourceImage);

                                                                                                              // add intermediate frames
                                                                                                              for (int frameIndex = 1; frameIndex < numOfFrames - 1; ++frameIndex)
                                                                                                              {
                                                                                                                  apngImage.AddFrame(sourceImage);
                                                                                                                  ApngFrame lastFrame = (ApngFrame)apngImage.Pages[apngImage.PageCount - 1];
                                                                                                                  float gamma = frameIndex >= numOfFrames2 ? numOfFrames - frameIndex - 1 : frameIndex;
                                                                                                                  lastFrame.AdjustGamma(gamma);
                                                                                                              }

                                                                                                              // add last frame
                                                                                                              apngImage.AddFrame(sourceImage);

                                                                                                              apngImage.Save();
                                                                                                          }
                                                                                                      }

NumPlays

수신 또는 롤 애니메이션에 시간의 수를 설정합니다.0은 무한한 라우팅을 나타냅니다.

public int NumPlays { get; set; }

부동산 가치

int

Examples

다음 예제는 APNG 파일 형식으로 수출하는 방법을 보여줍니다.

using Aspose.Imaging;
                                                                         using Aspose.Imaging.ImageOptions;

                                                                         using (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
                                                                             image.Save("Animation2.webp.png", new ApngOptions() { NumPlays = 5 }); // 5 cycles
                                                                         }
 한국어