Aspose.PSD .NET용 어댑터 빠른 시작 가이드

간단한 사용법

Aspose.PSD .NET용 어댑터는 다른 Aspose 제품과의 통합 코드 작성을 가능하게 하는 특별한 NuGet 패키지입니다.

Aspose.PSD 어댑터를 사용하려면 다음 안내를 확인해주세요:

  1. NuGet에서 Aspose.PSD.Adapters.Imaging을 참조하거나 Aspose 릴리스 페이지에서 다운로드하세요.(어댑터는 현재 주요 릴리스 아티팩트에 포함되어 있음) 필수 참조 항목
  • 참고: https://releases.aspose.com/psd/net/에서 Aspose.PSD.Adapters를 사용 중이라면 Aspose.Drawing 및 Aspose.Imaging을 추가로 NuGet 또는 로컬 파일에서 참조해야 합니다.
  1. 다음 코드를 추가하세요:
// This code allows to load the specified formats
Aspose.PSD.Adapters.Imaging.EnableLoaders(
FileFormat.Svg,
FileFormat.Webp);
// This code allows you to export using adapters
Aspose.PSD.Adapters.Imaging.EnableExporters();
// To work with adapters you need both Aspose.PSD and adaptee Licenses
var license = new Aspose.PSD.License();
license.SetLicense(@"Aspose.PSD.NET.lic");
var licImaging = new Aspose.Imaging.License();
licImaging.SetLicense(@"Aspose.Imaging.NET.lic");
// Aspose.Imaging loading and integration with PSD format will be provided seamless in this case.
using (var image = Image.Load(@"SomeFile.Webp"))
{
// Saving in this example is provided by Aspose.PSD
image.Save(@"output.png", new PngOptions() { ColorType = Aspose.PSD.FileFormats.Png.PngColorType.TruecolorWithAlpha });
}
  1. 어댑터를 사용하는 데 필요한 모든 것입니다.

추가적인 Adaptee별 옵션으로 익스포트 및 로딩

대부분의 경우 첫 번째 예제를 사용하는 것이 충분하지만, 복잡한 솔루션에서는 때로는 추가적인 옵션을 사용하여 변환해야 할 필요가 있습니다. 다음 예제를 확인해주세요:

// Create new Imaging-only supported Image (Can be used SVG, or any other not-supported in PSD Format)
using (WebPImage webp = new WebPImage(300, 300, null))
{
// Use Aspose.Imaging API to Edit WEBP file with Imaging-specific features
var gr = new Aspose.Imaging.Graphics(webp);
gr.Clear(Aspose.Imaging.Color.Wheat);
gr.DrawArc(
new Aspose.Imaging.Pen(Aspose.Imaging.Color.Black, 5),
new Aspose.Imaging.Rectangle(50, 50, 200, 200),
0,
270);
// Then just use ToPsdImage() method and edit file like PSD with Photoshop-like features including layers, smart filters and smart objects.
using (var psdImage = webp.ToPsdImage())
{
psdImage.AddTextLayer("Some text", new Rectangle(100, 100, 100, 50));
var hue = psdImage.AddHueSaturationAdjustmentLayer();
hue.Hue = 130;
// Save the final PSD file using Aspose.PSD
psdImage.Save("output.psd");
}
}

이 시점에서 추가적인 코드를 작성할 필요가 없습니다. 어댑터는 Aspose.PSD 및 그 Adaptees의 풍부한 API와 완벽하게 통합을 제공합니다.