PSD ファイルを PNG に変換しながら切り取る方法 (C#)
Contents
[
Hide
]
Aspose.PSD for .NET を使用すると、開発者は PSD 画像をラスターフォーマットに変換しながら画像を切り取ることができます。このトピックでは、既存の画像を読み込み、切り取り、ラスターフォーマットに変換するアプローチを説明しています。
PSD ファイルを PNG に変換しながら切り取る方法
以下に示すサンプルコードは、PSD 画像を PNG に変換しながら画像を切り取る方法を示しています。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-psd/Aspose.PSD-for-.NET | |
string sourceFileName = dataDir + "1.psd"; | |
string exportPathPsd = dataDir + "CropTest.psd"; | |
string exportPathPng = dataDir + "CropTest.png"; | |
using (RasterImage image = Image.Load(sourceFileName) as RasterImage) | |
{ | |
image.Crop(new Rectangle(10, 30, 100, 100)); | |
image.Save(exportPathPsd, new PsdOptions()); | |
image.Save(exportPathPng, new PngOptions() { ColorType = PngColorType.TruecolorWithAlpha }); | |
} |