Thursday, July 17, 2014

How to convert PSD into image file in c# with Magick.NET

Recently in one of project we had a requirement of converting a Adobe Photoshop file (PSD) into image file(.png) file. After digging while on internet I have found a great library which has so many features in can easily convert PSD files into any time of image file.

The Library is Magick.NET. It’s a open source project you can find more information about it from the following codeplex link.
https://magick.codeplex.com/

There are lots of example available for image conversion and other image editing functions. You can find that about that on documentation.
https://magick.codeplex.com/wikipage?title=Convert%20image

There are lots of NuGet package are available also. Following is a one of them.

NugetForMagick
So what are we waiting for it’s time to create console application and adding a NuGet package.
I have added NuGet like below from package manager console.

Convert image from one format to another format

For this example I have downloaded some sample PSD file from internet and need to convert that into .png file. Following is a code for that.

using ImageMagick;
namespace PSDtoImage
{
    class Program
    {
        static void Main(string[] args)
        {
            using (MagickImage image = new MagickImage("Flat Color Abstract City Background.psd"))
            {
                image.Write("Flat Color Abstract City Background.png");
            }
        }
    }
}
Now once you run this console application. It will convert your PSD file into .png file. Here in constructor you need to supply path of that image file.

That’s it. Hope you like it. Stay tuned for more!!
Share:

4 comments:

Your feedback is very important to me. Please provide your feedback via putting comments.

Support this blog-Buy me a coffee

Buy me a coffeeBuy me a coffee
Search This Blog
Subscribe to my blog

  

My Mvp Profile
Follow us on facebook
Blog Archive
Total Pageviews