Convert PSD to PNG from Command Line

By  on  

I've been fascinated by basic image manipulation these days, which led to my Get the First Frame of an Animated GIF with ImageMagick and How to Create Screenshots in Firefox posts.  It was brought up in a comment to the Animated GIF post that ImageMagick can also export an image from a layer Photoshop PSD file.  They were right!

From the command line, you'd execute the same command:

convert 'website-design.psd[0]' website-screenshot.png

This time you cite the PSD file and voila, an image is created in milliseconds.  Sure you can manually do this within Photoshop or create a macro to do so, but if you have loads of Photoshop files you want to generate screenshots for, ImageMagick is gold!

Recent Features

  • By
    Send Text Messages with PHP

    Kids these days, I tell ya.  All they care about is the technology.  The video games.  The bottled water.  Oh, and the texting, always the texting.  Back in my day, all we had was...OK, I had all of these things too.  But I still don't get...

  • By
    9 Mind-Blowing Canvas Demos

    The <canvas> element has been a revelation for the visual experts among our ranks.  Canvas provides the means for incredible and efficient animations with the added bonus of no Flash; these developers can flash their awesome JavaScript skills instead.  Here are nine unbelievable canvas demos that...

Incredible Demos

  • By
    Create a Simple News Scroller Using Dojo

    My journey into Dojo JavaScript has been exciting and I'm continuing to learn more as I port MooTools scripts to Dojo. My latest experiment is porting a simple new scroller from MooTools to Dojo. The code is very similar! The HTML The news items...

  • By
    Web Audio API

    The Web Audio API allows developers to load and decode audio on demand using JavaScript.  The more I evaluate awesome games for Firefox OS TVs, the more I get to learn about these APIs that I normally wouldn't touch.  The following is a very basic introduction to the WebAudio API...

Discussion

  1. Innnnteresting. This is probably a stupid question, but do you need Photoshop in order for it to export?

    • Jules Verne

      You need photoshop to create the image.

      Image magic is a complete separate tool

    • Jules is correct; you don’t need Photoshop to complete this.

  2. That’s amazing. If the above question is stupid, then this definitely is:
    How can ImageMagick decode the PSD at all if PS isn’t installed? Are PSDs packaged with some non-proprietary method? Like XML for layered images?

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!