Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hello, most esteemed monks.

I have a little problem to solve, in the place that I work, it would help our graphics artists Greatly if I could automatically convert their PSD files to TGA and/or PNG behind the scenes. Yes, it is possible that we could use PS macros for this, but it would really be much better if it could be done via Perl, for several reasons; there are already scripts doing other things, this should be deployed on several machines with differing paths and several projects, Subversion integration with the SVN modules etc. Let's just say I want to give it a good try. :)

I've been looking all over the net, real deeply to find anything that might work, and went through the available Perl modules I could find and think of. Most can't do PSD at all, and Image::Magick can't handle flattening the layers properly (same with the command line client). The only thing I've had success with at all is to use the command line interface to IrfanView, which can read these PSD:s flawlessly and output both TGA and PNG. However, this is not a solution I'm that comfortable with: IrfanView has lots of troubles with paths given on the command line, it is only free for non-commercial use (and this is a borderline case I'd say) and it is Windows only (can live with that if I must).

Most of all, I would like to find some kind of Open Source alternative if possible, or at least something that I can use with good conscience, and if it would be appropriate, can re-distribute freely. Easy to use from Perl and cross platform would be great bonuses.

Does anyone here have any tips? It seems strange that no Open Source software should be able to read PSD files correctly, when so much different (closed) Windows software can do it, so I'm almost assuming that my Google skills are lacking, even though I've been trying for days now. ;-)

Any tips appreciated.

  • Comment on Convert PSD (photoshop) to TGA and/or PNG?

Replies are listed 'Best First'.
Re: Convert PSD (photoshop) to TGA and/or PNG?
by Aristotle (Chancellor) on Jan 25, 2005 at 21:12 UTC

    Gimp in conjunction with Gimp-Perl might be a solution. Have a look at the tutorial.

    Makeshifts last the longest.

      Well, I knew that there was something I forgot to mention. :) I've considered the Gimp and its scripting capabilities, I do use it on occassion on Linux after all. However, that seems quite a HUGE beast to install, along with all the dependencies for accessing it under Perl, considering this should be installed on a number of computers (and thus, preferably packaged).

      Also, Solo mentions limited support for PSD, any idea what that means? Limited support was what ImageMagick had too, which was why that wasn't usable.

      Appreciate the suggestion though, my fault for forgetting to mention my thoughts on the GIMP up front. Sorry.

        I don't know how limited the PSD support is or isn't. I don't have Photoshop and don't deal with people who do, so I don't have any PSDs, and thus I can't say anything about that.

        Yeah, it's a very heavyweight solution. That's the only thing I know to suggest though. NetPBM, the “other” big processing package (and incidentally the one I like best) doesn't do PSD at all.

        The only thing I can still suggest is Imagero Reader — which you'd have to wrap with Inline::Java

        Makeshifts last the longest.

Re: Convert PSD (photoshop) to TGA and/or PNG?
by Solo (Deacon) on Jan 25, 2005 at 21:16 UTC
    Update: Yea. What he said.

    For more information about this node see here:

    What about the GIMP? It has only limited support for .PSD, but it might cover your needs.

    --Solo

    --
    You said you wanted to be around when I made a mistake; well, this could be it, sweetheart.
Re: Convert PSD (photoshop) to TGA and/or PNG?
by ww (Archbishop) on Jan 26, 2005 at 15:32 UTC
    You might want to consider Calling a C API in a dll from Perl on Windows (and perhaps some related recent threads). If applicable, and if PhotoShop does png and tga, you may be able to let Photoshop do the work, under perl's direction.