Can not convert PSD to JPG or PNG (gm convert: Memory allocation failed)
Swiss army knife of image processing
Brought to you by:
bfriesen
Hi, I try convert a PSD file to JPG and PNG but I could not succeed.
The command used is:
gm convert -log %e -debug coder T200NA_L01_04.psd file.png
Invoking "PSD" decoder (Adobe Photoshop bitmap) subimage=0 subrange=0
enter
Image is 107 x 96 with channels=3, depth=8, mode=RGB
image has no matte
reading image resources (IPTC) - 48244 bytes
image contains 0 layers
allocation of LayerInfo failed
return
Returned from "PSD" decoder, returned image is NULL!
gm convert: Memory allocation failed (T200NA_L01_04.psd).
but when I use a EPS file it works:
gm convert -log %e -debug coder T200NA_L01_04.eps T200NA_L01_04.eps_6.jpg
Invoking "EPT" decoder (Adobe Encapsulated PostScript with MS-DOS TIFF preview) subimage=0 subrange=0
Density: 72x72
File Size: 104195, Offset: 7256
Copying Postscript to temporary file "/tmp/gmNmkTtw" ...
Done copying.
Page geometry: 107x96
...
Writing 8 bit JCS_RGB or JCS_YCbCr samples
Finishing JPEG compression
Returned from "JPG" encoder
I read the documentation about that problem "http://www.graphicsmagick.org/FAQ.html#i-get-a-memory-allocation-error-what-can-i-do" and I created the environment variable "MAGICK_TMPDIR" and it doesn't work:
echo $MAGICK_TMPDIR
/home/nvaleancia/MAGICK_TMPDIR
Can you help me?, I try execute this convert in two different versions:
----------------
1. first environment
gm version
GraphicsMagick 1.3.18 2013-03-10 Q8 http://www.GraphicsMagick.org/
Copyright (C) 2002-2013 GraphicsMagick Group.
Additional copyrights and licenses apply to this software.
See http://www.GraphicsMagick.org/www/Copyright.html for details.
Feature Support:
Thread Safe yes
Large Files (> 32 bit) yes
Large Memory (> 32 bit) yes
BZIP no
DPS no
FlashPix no
FreeType yes
Ghostscript (Library) no
JBIG no
JPEG-2000 no
JPEG yes
Little CMS no
Loadable Modules no
OpenMP yes (201107)
PNG yes
TIFF yes
TRIO no
UMEM no
WMF no
X11 no
XML no
ZLIB yes
Host type: x86_64-unknown-linux-gnu
Configured using the command:
./configure
Final Build Parameters:
CC = gcc -std=gnu99
CFLAGS = -fopenmp -g -O2 -Wall -pthread
CPPFLAGS = -I/usr/include/freetype2
CXX = g++
CXXFLAGS = -pthread
LDFLAGS = -L/usr/lib
LIBS = -ltiff -lfreetype -ljpeg -lpng15 -lz -lm -lgomp -lpthread
----------------
2. Second environment
gm version
GraphicsMagick 1.3.1 2008-11-17 Q8 http://www.GraphicsMagick.org/
Copyright (C) 2002-2008 GraphicsMagick Group.
Additional copyrights and licenses apply to this software.
See http://www.GraphicsMagick.org/www/Copyright.html for details.
Feature Support:
Thread Safe yes
Large Files (> 32 bit) yes
Large Memory (> 32 bit) yes
BZIP no
DPS no
FlashPix no
FreeType yes
Ghostscript (Library) no
JBIG no
JPEG-2000 no
JPEG yes
Little CMS no
Loadable Modules yes
OpenMP yes (200505)
PNG yes
TIFF yes
TRIO no
UMEM no
WMF no
X11 no
XML no
ZLIB yes
Host type: x86_64-unknown-linux-gnu
Configured using the command:
./configure '--enable-shared' --enable-ltdl-convenience
Final Build Parameters:
CC = gcc -std=gnu99
CFLAGS = -fopenmp -g -O2 -Wall -pthread
CPPFLAGS = -I/usr/include/freetype2
CXX = g++
CXXFLAGS = -pthread
LDFLAGS = -L/usr/lib
LIBS = -ltiff -lfreetype -ljpeg -lpng -lz -lm -lgomp -lpthread
Any idea?
Thanks!
Hi, I continue testing and I find other images that don't generate the "Memory allocation failed" error, but the final result is not correct.
Please see the attached images (source and converted) converted with the next commands:
Do you have any idea?
Thanks!!!
The PSD reader in GraphicsMagick is very poor. It is difficult to make it better because PSD is very complex and its documentation is very sparse. PSD is really a description of how Adobe Photoshop works internally.
The memory allocation error is likely due to a deficiency in the PSD reader rather than in GraphicsMagick's main image memory allocation.
The best PSD reader I have seen in free software is in GNU GIMP. Give the GIMP a try.
Ok, Thanks
Hi, I executed some test of AI and PSD files with ImageMagick and it works then I go to use GraphicsMagicks for convert some file types and ImageMagicks for convert AI and PSD file types.
Thanks.
I am seeing the same error in both GraphicsMagick v1.3.18 & v1.3.19 with one of my PSD files. ImageMagick v6.8.7-7 processes the file correct as well as other tools (PixelMator, OS X Preview, etc.)
Can you extract the PSD reader from ImageMagick or are the licenses incompatible?
On Tue, 4 Feb 2014, RNHurt wrote:
The licences are not incompatible but if GraphicsMagick was to do
this, it would become subservient to the ImageMagick project (due to
its license) and we are not willing to do that.
The PSD reader in GraphicsMagick has bugs. We are still seeking a
volunteer to work on it.
Bob
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
Hello, I encounter the same problem.
The problem here is that GM doesn't correctly handle PSD files without layers ( only background ) and try to allocate some memory.
I'll try to submit a fix soon.
Any working PSD fixes are appreciated. We really need someone to step up and take ownership of the PSD reader. Gradual fixes and enhancements will result in a PSD reader which satisfies most common usages.
Hello, I have added a patch in the patch section with the ID #41.
Fixed by SF patch #41. Mercurial changeset 9ccd96513995.