Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reading PSD file format

I wonder if this is even possible. I have an application that adds a context menu when you right click a file. It all works fine but here is what I'd like to do:

If the file is a PSD then I want the program to extract the image. Is this possible to do without having Photoshop installed?

Basically I want the user to right click and click "image" which would save a .jpg of the file for them.

edit: will be using c# Thanks

like image 911
masfenix Avatar asked Jan 05 '09 23:01

masfenix


People also ask

How can I view a PSD file without Photoshop?

GIMP is a free, open source alternative to Photoshop. It can open PSD files and even preserves layer information. GIMP is the most powerful option on this list and will allow you to make other modifications to the file.

Can I convert a PSD file to JPG?

How to convert files from PSD to JPG. Choose File and select Save As. Or, choose File, then Export, and Save for Web (Legacy). Either process can be used to save CMYK, RGB, or grayscale images.


1 Answers

The ImageMagick libraries (which provide bindings for C#) also support the PSD format. They might be easier to get started with than getting into the Paint.NET code and also come with a quite free (BSD-like) license.

A simple sample (found at http://midimick.com/magicknet/magickDoc.html) using MagickNet would look like this:

using System;  static void Main(string[] args) {     MagickNet.Magick.Init();     MagicNet.Image img = new MagicNet.Image("file.psd");     img.Resize(System.Drawing.Size(100,100));     img.Write("newFile.png");     MagickNet.Magick.Term(); } 

Note: MagickNet has moved to http://www.codeproject.com/KB/dotnet/ImageMagick_in_VBNET.aspx

like image 151
Dirk Vollmar Avatar answered Sep 20 '22 08:09

Dirk Vollmar