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:

5 comments:

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

Search This Blog
About Me
My Photo

Full Stack Developer,Blogger,Microsoft Mvp, Mentor, Life long learner, 10+ Years of Experience for JavaScript, web and Microsoft technologies. ASP.NET MVC,Web Forms,C#,AngularJs,Golang
Mvp profile
Subscribe to my blog

Enter your email address:

Follow us on facebook
Blog Archive
Total Pageviews