Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Given the following command line:

'/usr/bin/gm' convert 'directory/filename.psd[0]' filename.jpg

I will always receive all layers from the .psd as output:

$ ls something*
something.jpg.0  something.jpg.1  something.jpg.2

The documentation clearly states:

Use a square-bracket syntax to indicate which frame or frames you want. For example,

gm convert "Image.gif[0]" first.gif
Will extract the first image (scene 0) from a GIF animation. Be sure to surround the file specification with quotation marks, to prevent the shell from interpreting the square brackets.

I tried messing around with it in many ways, but I always end up with the same result.

Version information:

GraphicsMagick 1.3.12 2010-03-08 Q8
Copyright (C) 2002-2010 GraphicsMagick Group.
Additional copyrights and licenses apply to this software.
See for details.

Feature Support:
  Thread Safe              no
  Large Files (> 32 bit)   yes
  Large Memory (> 32 bit)  no
  BZIP                     yes
  DPS                      no
  FlashPix                 no
  FreeType                 yes
  Ghostscript (Library)    no
  JBIG                     no
  JPEG-2000                no
  JPEG                     yes
  Little CMS               yes
  Loadable Modules         yes
  OpenMP                   no
  PNG                      yes
  TIFF                     yes
  TRIO                     no
  UMEM                     no
  WMF                      yes
  X11                      no
  XML                      yes
  ZLIB                     yes

Host type: i686-pc-linux-gnu

Configured using the command:
  ./configure  '--prefix=/usr' '--build=i686-pc-linux-gnu' '--host=i686-pc-linux-gnu' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share'                                                                  '--sysconfdir=/etc' '--localstatedir=/var/lib' '--docdir=/usr/share/doc/graphicsmagick-1.3.12' '--htmldir=/usr/share/doc/graphicsmagick-1.3.12/html' '--enable-shar                                                                 ed' '--enable-largefile' '--without-included-ltdl' '--without-frozenpaths' '--without-gslib' '--with-quantum-depth=8' '--with-fontpath=/usr/share/fonts' '--with-gs                                                                 -font-dir=/usr/share/fonts/default/ghostscript' '--with-windows-font-dir=/usr/share/fonts/corefonts' '--with-perl-options=INSTALLDIRS=vendor' '--disable-ccmalloc'                                                                  '--disable-prof' '--disable-gcov' '--disable-magick-compat' '--disable-openmp' '--with-bzlib' '--with-magick-plus-plus' '--without-fpx' '--without-jbig' '--with-jp                                                                 eg' '--without-jp2' '--with-lcms' '--with-modules' '--with-perl' '--with-png' '--with-xml' '--without-threads' '--with-tiff' '--with-ttf' '--with-wmf' '--without-x                                                                 ' '--with-zlib' 'build_alias=i686-pc-linux-gnu'

Final Build Parameters:
  CC       = i686-pc-linux-gnu-gcc -std=gnu99
  CFLAGS   = -O2 -march=i686 -fomit-frame-pointer -Wall
  CPPFLAGS = -I/usr/include/freetype2 -I/usr/include/libxml2
  CXX      = i686-pc-linux-gnu-g++
  CXXFLAGS = -O2 -march=i686 -fomit-frame-pointer
  LDFLAGS  = -Wl,-O1 -Wl,--as-needed -L/usr/lib -L/usr/lib
  LIBS     = -llcms -lfreetype -lbz2 -lz -lm
share|improve this question
up vote 1 down vote accepted

It sounds like you need to flatten the PSD to a single layer. I would try adding the -flatten flag to your line. This may convert all of the layers to one JPG instead of multiple files.

Also, it looks like by adding the [0] you're telling it to loop through the layers as it would the sequence of images in a gif file.

share|improve this answer
While that might work (and I will be thankful if it does), why doesn't my approach work? It seems like I use it exactly as described in the documentation. – Oliver Salzburg Mar 8 '12 at 23:08
Because by adding the [0], it looks like a "command" to loop through the possible images/layers in the specified file to export several files based on that information. That may be very useful to some, but counterproductive to others. – kobaltz Mar 8 '12 at 23:11
The main problem, I believe is that your documentation is to split an Animated GIF image into several files. Almost like taking a movie and making several images from each frame of the movie. – kobaltz Mar 8 '12 at 23:11
What kind of makes me doubt this, is the fact if I use ImageMagicks convert for the same purpose, it outputs a single file when using [0] and multiple files when not providing [0]. – Oliver Salzburg Mar 8 '12 at 23:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.