Crop Rotate PSD C#

Introduktion

PSD-billeder er væsentlige i grafisk design og visuelle projekter. Uanset om du søger at forbedre en design eller opfylde specifikke æstetiske mål, ved at køre eller rotere et PSD-billede kan være utroligt nyttigt. I denne artikel vil vi gå dig gennem trinene til effektivt at køre eller rotere et PSD-billede ved hjælp af C#. Her er hvad du kan forvente at lære:

Installation af C# .NET API for PSD Manipulation

To manipulate PSD files effortlessly, you can utilize the Aspose.PSD til .NET API. This powerful tool enables you to create, edit, and manage PSD files, along with various other Photoshop formats. Setting up the API is straightforward. You can either download the DLL file from the Nye udgivelser page or use the following NuGet installation command in Microsoft Visual Studio:

PM> Install-Package Aspose.PSD

Kropning af et PSD-billede ved hjælp af Shift-metoden i C#

For at dyrke et PSD-billede ved at skifte dets indhold til centrum, skal du følge disse trin:

  • Load the input PSD image using an instance of the Rasterbilleder class.
  • Cache the PSD image using the CacheData method for improved performance.
  • Specify the shift values and call the Kræft method.
  • Beskyt billedet til din ønskede placering.

Her er et kodesnit, der viser, hvordan man programmerer et PSD-billede i C#:

Kropning af et PSD-billede med retangulære koordinater i C#

Du kan også dyrke specifikke sektioner af en PSD-billede ved hjælp af rektangulære koordinater. For at opnå dette, skal du følge disse trin:

  • Load the input PSD file with the Rasterbilleder class.
  • Cache inputbilledet for forbedret ydeevne.
  • Create a Rektangle object with your desired coordinates.
  • Crop det PSD-billede og gem den output-fil.

Følgende kodesnit illustrerer, hvordan man græder et PSD-billede ved hjælp af rektangulære koordinater i C#:

Rotering af et PSD-billede i ethvert hjørne ved hjælp af C#

Rotering af et PSD-billede i ethvert angivet hjørne kan opnås med følgende trin:

  • Load the input PSD image using the Rasterbilleder class.
  • Glem billedet for at forbedre ydeevnen.
  • Set the desired angle of rotation using the Rotation method.
  • Save den roterede PSD-fil.

Her er et kodesnit, der viser, hvordan man programmerer et PSD-billede i C#:

Få en gratis evalueringslicens

To explore the API’s full capabilities, you can request a Gratis evalueringslicens.

Konklusion

In this article, you’ve learned how to crop or rotate a PSD image programmatically using C#. By integrating these features into your .NET applications, you can significantly enhance your graphics processing capabilities for just $99. For further details, please visit the Dokumentation section. If you have any inquiries, feel free to reach out through the Gratis supportforum.

More in this category