Class SvgImage

Class SvgImage

名称: Aspose.Imaging.FileFormats.Svg アセンション: Aspose.Imaging.dll (25.4.0)

Scalar Vector Graphics (SVG) 画像ファイルを API で操作し、XML ベースのテキスト フォーマットのパワー 無線のカスタマイズとスケール性。SVG画像を簡単に充電し、ベクトル要素をラスター化し、他のフォーマットに変換し、プロジェクトのファイルサイズと品質を最適化するために圧縮レベルを制御します。

[JsonObject(MemberSerialization.OptIn)]
public sealed class SvgImage : VectorImage, IDisposable, IObjectWithBounds, IObjectWithSizeF, IHasXmpData, IHasMetadata

Inheritance

object DisposableObject DataStreamSupporter Image VectorImage SvgImage

Implements

IDisposable , IObjectWithBounds , IObjectWithSizeF , IHasXmpData , IHasMetadata

相続人

VectorImage.GetEmbeddedImages() , VectorImage.RemoveBackground() , VectorImage.RemoveBackground(RemoveBackgroundSettings) , VectorImage.Resize(int, int, ResizeType) , VectorImage.Resize(int, int, ImageResizeSettings) , VectorImage.RotateFlip(RotateFlipType) , VectorImage.Crop(Rectangle) , VectorImage.Rotate(float) , VectorImage.SizeF , VectorImage.WidthF , VectorImage.HeightF , VectorImage.Width , VectorImage.Height , Image.CanLoad(string) , Image.CanLoad(string, LoadOptions) , Image.CanLoad(Stream) , Image.CanLoad(Stream, LoadOptions) , Image.Create(ImageOptionsBase, int, int) , Image.Create(Image[]) , Image.Create(MultipageCreateOptions) , Image.Create(string[], bool) , Image.Create(string[]) , Image.Create(Image[], bool) , Image.GetFileFormat(string) , Image.GetFileFormat(Stream) , Image.GetFittingRectangle(Rectangle, int, int) , Image.GetFittingRectangle(Rectangle, int[], int, int) , Image.Load(string, LoadOptions) , Image.Load(string) , Image.Load(Stream, LoadOptions) , Image.Load(Stream) , Image.GetProportionalWidth(int, int, int) , Image.GetProportionalHeight(int, int, int) , Image.RemoveMetadata() , Image.CanSave(ImageOptionsBase) , Image.Resize(int, int) , Image.Resize(int, int, ResizeType) , Image.Resize(int, int, ImageResizeSettings) , Image.GetDefaultOptions(object[]) , Image.GetOriginalOptions() , Image.ResizeWidthProportionally(int) , Image.ResizeHeightProportionally(int) , Image.ResizeWidthProportionally(int, ResizeType) , Image.ResizeHeightProportionally(int, ResizeType) , Image.ResizeWidthProportionally(int, ImageResizeSettings) , Image.ResizeHeightProportionally(int, ImageResizeSettings) , Image.RotateFlip(RotateFlipType) , Image.Rotate(float) , Image.Crop(Rectangle) , Image.Crop(int, int, int, int) , Image.Save() , Image.Save(string) , Image.Save(string, ImageOptionsBase) , Image.Save(string, ImageOptionsBase, Rectangle) , Image.Save(Stream, ImageOptionsBase) , Image.Save(Stream, ImageOptionsBase, Rectangle) , Image.GetSerializedStream(ImageOptionsBase, Rectangle, out int) , Image.SetPalette(IColorPalette, bool) , Image.BitsPerPixel , Image.Bounds , Image.Container , Image.Height , Image.Palette , Image.UsePalette , Image.Size , Image.Width , Image.InterruptMonitor , Image.BufferSizeHint , Image.AutoAdjustPalette , Image.HasBackgroundColor , Image.FileFormat , Image.BackgroundColor , DataStreamSupporter.CacheData() , DataStreamSupporter.Save() , DataStreamSupporter.Save(Stream) , DataStreamSupporter.Save(string) , DataStreamSupporter.Save(string, bool) , DataStreamSupporter.DataStreamContainer , DataStreamSupporter.IsCached , DisposableObject.Dispose() , DisposableObject.Disposed , object.GetType() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Examples

下記の例では、 svgz 画像を svg fromat に変換する方法を示しています。

string file = "example.svgz";
                                                                                 string baseFolder = System.IO.Path.Combine("D:", "Compressed");
                                                                                 string inputFile = System.IO.Path.Combine(baseFolder, file);
                                                                                 string outFile = inputFile + ".svg";
                                                                                 using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(inputFile))
                                                                                 {
                                                                                     Aspose.Imaging.ImageOptions.VectorRasterizationOptions vectorRasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions() { PageSize = image.Size};
                                                                                     image.Save(outFile, new Aspose.Imaging.ImageOptions.SvgOptions() {VectorRasterizationOptions = vectorRasterizationOptions});
                                                                                 }

下記の例では、 svg 画像を svgz からat に変換する方法を示しています。

string file = "juanmontoya_lingerie.svg";
                                                                                 string baseFolder = System.IO.Path.Combine("D:", "Compressed");
                                                                                 string inputFile = System.IO.Path.Combine(baseFolder, file);
                                                                                 string outFile = inputFile + ".svgz";
                                                                                 using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(inputFile))
                                                                                 {
                                                                                     Aspose.Imaging.ImageOptions.VectorRasterizationOptions vectorRasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions() { PageSize = image.Size};
                                                                                     image.Save(outFile, new Aspose.Imaging.ImageOptions.SvgOptions() {VectorRasterizationOptions = vectorRasterizationOptions, Compress = true});
                                                                                 }

この例では、ファイルストリームからSVG画像をアップロードし、PNGにラスターする方法を示しています。

string dir = "c:\\temp\\";

                                                                                                  // Load an SVG image from a file stream.
                                                                                                  using (System.IO.Stream stream = System.IO.File.OpenRead(dir + "test.svg"))
                                                                                                  using (Aspose.Imaging.FileFormats.Svg.SvgImage svgImage = new Aspose.Imaging.FileFormats.Svg.SvgImage(stream))
                                                                                                  {
                                                                                                      // In order to rasterize SVG we need to specify rasterization options.
                                                                                                      Aspose.Imaging.ImageOptions.SvgRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
                                                                                                      Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                      saveOptions.VectorRasterizationOptions = rasterizationOptions;

                                                                                                      svgImage.Save(dir + "test.output.png", saveOptions);
                                                                                                  }

下記の例では、圧縮された画像を変換する方法を示しています(エムズ.wmz, *.svgz) に ラスター スライド

string[] files = new[] {"example.emz", "example.wmz", "example.svgz"};
                                                                                                                string baseFolder = System.IO.Path.Combine("D:","Compressed");
                                                                                                                foreach (var file in files)
                                                                                                                {
                                                                                                                    string inputFile = System.IO.Path.Combine(baseFolder, file);
                                                                                                                    string outFile = inputFile + ".png";
                                                                                                                    using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(inputFile))
                                                                                                                    {
                                                                                                                        Aspose.Imaging.ImageOptions.VectorRasterizationOptions vectorRasterizationOptions = (Aspose.Imaging.ImageOptions.VectorRasterizationOptions)image.GetDefaultOptions(new object[] { Color.White, image.Width, image.Height });
                                                                                                                        image.Save(outFile, new Aspose.Imaging.ImageOptions.PngOptions(){VectorRasterizationOptions = vectorRasterizationOptions});
                                                                                                                    }
                                                                                                                }

Constructors

SvgImage(ストレッチ)

Aspose.Imaging.FileFormats.Svg.SvgImage クラスの新しいオブジェクトをインスタントし、画像を位置づけ、充電するための指定されたルートです。この構造主は、外部ファイルから SVG イメージの例を作成し、シェイムなしを可能にしますソフトウェアシステムとワークフローへの統合

public SvgImage(string path)

Parameters

path string

画像をアップロードし、ピクセルとパレットデータを開始するための道です。

Exceptions

ArgumentNullException

道はゼロ。

SvgImage(Stream)

Aspose.Imaging.FileFormats.Svg.SvgImage クラスの新しい例を作成し、画像をアップロードします。この構築機は、SVGの直接充電を可能にします。ストリームからの画像、画像処理の柔軟性と効率性を向上させるソフトウェアアプリケーションにおける資源

public SvgImage(Stream stream)

Parameters

stream Stream

ストリームから画像をアップロードし、ピクセルとパレットデータを開始します。

Examples

この例では、ファイルストリームからSVG画像をアップロードし、PNGにラスターする方法を示しています。

string dir = "c:\\temp\\";

                                                                                                  // Load an SVG image from a file stream.
                                                                                                  using (System.IO.Stream stream = System.IO.File.OpenRead(dir + "test.svg"))
                                                                                                  using (Aspose.Imaging.FileFormats.Svg.SvgImage svgImage = new Aspose.Imaging.FileFormats.Svg.SvgImage(stream))
                                                                                                  {
                                                                                                      // In order to rasterize SVG we need to specify rasterization options.
                                                                                                      Aspose.Imaging.ImageOptions.SvgRasterizationOptions rasterizationOptions = new Aspose.Imaging.ImageOptions.SvgRasterizationOptions();
                                                                                                      Aspose.Imaging.ImageOptions.PngOptions saveOptions = new Aspose.Imaging.ImageOptions.PngOptions();
                                                                                                      saveOptions.VectorRasterizationOptions = rasterizationOptions;

                                                                                                      svgImage.Save(dir + "test.output.png", saveOptions);
                                                                                                  }

Exceptions

ArgumentNullException

流れはゼロ。

SvgImage(int、 int)

新しい Aspose.Imaging.FileFormats.Svg.SvgImage オブジェクトを指定した幅とこの構築機は、開発者がSVG画像を作成することを可能にします。サイズは、画像のサイズの正確なコントロールを容易にします。イニシアチブ

public SvgImage(int width, int height)

Parameters

width int

画像の幅

height int

画像の高さ。

SvgImage(オプション、 int、 int)

Aspose.Imaging.FileFormats.Svg.SvgImage クラスの新しい例を作成します。オプション、画像幅、および高さパラメーター この構築器は、開発者は、カスタマイズされたオプションとサイズでSVG画像をイニシアチブ化するために、SVGコンテンツとレイアウトの管理における柔軟性を提供します。

public SvgImage(SvgOptions svgOptions, int width, int height)

Parameters

svgOptions SvgOptions

SVGの選択肢

width int

画像幅

height int

画像の高さ

Properties

BitsPerPixel

画像のピクセル数に比べてビットを振り返る。このパラメーターは、それらが測定されていないため、ベクトル画像には適用されません。ピクセル この属性は、画像の色に関する重要な情報を提供します。深さ、処理および操作の課題に役立ちます。

public override int BitsPerPixel { get; }

不動産価値

int

Exceptions

NotImplementedException

ベクトル画像の有効性

FileFormat

画像のファイル形式をリトレートし、基本的なメタデータを提供します。プロセッサおよび互換性チェック. この属性は、適切な解読および暗号化戦略を決定する画像データは、さまざまなシステムやアプリケーションを通じて効果的に表示されます。

public override FileFormat FileFormat { get; }

不動産価値

FileFormat

IsCached

オブジェクトのデータが現時点にあるかどうかを示すボーレー値を返します。cache, eliminating the need for additional data reading operations. この財産は、現在のキャッシング状態に洞察を提供し、データを最適化します。パフォーマンスと効率を向上させるための回収および処理作業流。

public override bool IsCached { get; }

不動産価値

bool

XmpData

XMP データを取得またはセットします。

public XmpPacketWrapper XmpData { get; set; }

不動産価値

XmpPacketWrapper

Methods

CacheData()

データを隠し、さらなるデータの充電がないことを保証します。ベース Aspose.Imaging.DataStreamSupporter.DataStreamContainer. この最適化によりパフォーマンスを向上させ、リダンダントデータ収集を排除する活動は、特に頻繁にアクセスする必要があるシナリオで有益である。イメージデータ

public override void CacheData()

Crop(Rectangle)

指定された直角を切る。

public override void Crop(Rectangle rectangle)

Parameters

rectangle Rectangle

直角です。

GetDefaultOptions(対象[])

画像に設定されたデフォルトオプションを修正し、ベースラインを提供します。複数の操作の設定、例えばリサイクル、圧縮、または暗号化。この方法は、一貫した行動と品質基準を確保する上で重要です。画像処理の課題は、明確なパラメーター化の必要性なし。

public override ImageOptionsBase GetDefaultOptions(object[] args)

Parameters

args object ( )

主張は。

Returns

ImageOptionsBase

デフォルトオプション

GetImage2Export(ImageOptionsBase、Rectangle、IImageExporter)

イメージを輸出する。

protected override Image GetImage2Export(ImageOptionsBase optionsBase, Rectangle boundsRectangle, IImageExporter exporter)

Parameters

optionsBase ImageOptionsBase

イメージオプションベース

boundsRectangle Rectangle

境界線は直角。

exporter IImageExporter

エクスポート

Returns

Image

イメージは輸出

ReleaseManagedResources()

管理されたリソースをリリースします. 管理されていないリソースがリリースされていないことを確認してください. リソースはすでにリリースされているかもしれません。

protected override void ReleaseManagedResources()

Resize(int、 int、 resizeType)

画像をリサイクルして指定された次元に調和し、その外観を維持します。この方法は、画像のサイズを調整するための便利な方法を提供します。割合を損なうことなく、最適な表示または保管を確保する望ましいサイズに応じて。

public override void Resize(int newWidth, int newHeight, ResizeType resizeType)

Parameters

newWidth int

新しい広さ。

newHeight int

新しい高さ。

resizeType ResizeType

リサイクルタイプ。

Rotate(フラット)

中心の周りを回転するイメージ。

public override void Rotate(float angle)

Parameters

angle float

ポジティブな値は時計的に回転します。

SaveData(Stream)

データを保存します。

protected override void SaveData(Stream stream)

Parameters

stream Stream

データを保存するためのストリーム。

SetPalette(ボール、ボール)

画像に指定されたパレットを適用し、色のカスタマイズを可能にします。エステティックまたは機能的な目的のためのスケジュール この方法は柔軟性を提供します色パレットを管理して、さまざまなデザインやアプリケーションの要件に合致します。

public override void SetPalette(IColorPalette palette, bool updateColors)

Parameters

palette IColorPalette

パレットを設定する。

updateColors bool

「真実」に設定された色は、新しいパレットに従って更新されます; そうでなければ、色指数は変わらないままです. 変更されていない指数は、いくつかの指数が相応するパレットエントリーを持っていない場合、ロード上の画像が崩壊する可能性があります。

Exceptions

NotImplementedException

 日本語