Reading PSD file format

后端 未结 11 1180
时光说笑
时光说笑 2020-12-04 11:13

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

相关标签:
11条回答
  • 2020-12-04 12:11

    For people who are reading this now: the link from accepted answer doesn't seem to work anymore (at least for me). Would add a comment there, but not allowed to comment yet - hence I'm adding a new answer.

    The working link where you can find the psdplugin code for Paint.Net: https://github.com/PsdPlugin/PsdPlugin

    0 讨论(0)
  • 2020-12-04 12:12

    FastStone does this pretty efficiently. They do not have their libraries availaible, but I guess you can contact them and see if they can help.

    Check out their website: http://www.faststone.org/download.htm

    0 讨论(0)
  • 2020-12-04 12:14

    You can use GroupDocs.Viewer for .NET API to render your PSD files as images (JPG, PNG, BMP) in your application using a few lines of code.

    C#

    ViewerConfig config = new ViewerConfig();
    config.StoragePath = "D:\\storage\\";
    
    // Create handler
    ViewerImageHandler imageHandler = new ViewerImageHandler(config);
    
    // Guid implies that unique document name 
    string guid = "sample.psd";
    
    // Get document pages as images
    List<PageImage> pages = imageHandler.GetPages(guid);
    
    foreach (PageImage page in pages)
    {
        // Access each image using page.Stream
    }
    

    For more details and sample code, please visit here. Disclosure: I work as a Developer Evangelist at GroupDocs.

    0 讨论(0)
  • 2020-12-04 12:15

    Well, there's a PSD plugin for Paint.NET which I think is Open-Source which you might want to take a look at for starters:

    http://frankblumenberg.de/doku/doku.php?id=paintnet:psdplugin#download

    0 讨论(0)
  • 2020-12-04 12:18

    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

    0 讨论(0)
提交回复
热议问题