Aspose.PSD .NET İçin Adaptörler Hızlı Başlangıç Kılavuzu

Basit Kullanım

Aspose.PSD .NET için Adaptörler, diğer Aspose Ürünleri ile entegrasyon kodunu daha az yazmanıza olanak tanıyan özel Nuget Paketleridir.

Aspose.PSD Adaptörlerini kullanmaya başlamak için lütfen aşağıdaki talimatları kontrol edin:

  1. Nuget’ten Aspose.PSD.Adapters.Imaging’ı referans olarak ekleyin veya onları Aspose Sürüm Sayfasından indirin (Adaptörler şu anda ana sürümle birlikte yayın artefaktında bulunmaktadır). Gereken referanslar
  • Lütfen Dikkat: Eğer Aspose.PSD.Adapters’ı https://releases.aspose.com/psd/net/ adresinden kullanıyorsanız, ayrıca Nuget veya yerel dosyalardan Aspose.Drawing ve Aspose.Imaging’i referans olarak eklemeniz gerekmektedir.
  1. Aşağıdaki kodu ekleyin:
// 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. Bu kadar, adaptörleri kullanmak için ihtiyacınız olan tek şey budur.

Ekstra Adaptee Özel Seçenekleri ile Dışa Aktarma ve Yükleme

Çoğu durumda, ilk örneği kullanmak yeterli olacaktır, ancak karmaşık çözümlerde bazen ek seçeneklerle dönüşümler yapmak gerekebilir. Lütfen aşağıdaki örneği kontrol edin:

// 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");
}
}

Bu noktada herhangi bir ek kod yazmanıza gerek yok. Adaptörler, Aspose.PSD ve onun Adapteli zengin API’si ile sorunsuz entegrasyon sağlar.