Is there a way to speed up loading of a psd file?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
ingen2k

Is there a way to speed up loading of a psd file?

Post by ingen2k »

Hello. I've been struggling with this for quite a while now without getting anywhere, so I finally broke down and registered to ask if anyone knew about this.

I'm using Magick++ to load images into a program I'm working on. It works fine, and I eventually get the correct image data loaded, but it takes way too long to load a psd file. Benchmarked against Quicktime Image Magick currently takes twice as long to load the same files, and this is why I'm asking. I've tried adding a [0] to the end of the string with the path to the file, but it does nothing for speed. Is there anything I can do to speed things up, like only load the pre-composited image of a psd file, or am I stuck with the slow speeds?

Thanks in advance. =)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Is there a way to speed up loading of a psd file?

Post by magick »

Add '[0]' to your filename returns the pre-composited layer from a PSD image. Regarding performance, post a URL to your image here and we will profile it and see if there are opportunities for speed-ups.
ingen2k

Re: Is there a way to speed up loading of a psd file?

Post by ingen2k »

Thanks for the reply.

There's no particular image I'm interested in loading faster, just in general psd load times seem very slow compared to when I do the same thing in Quicktime.
I'm already adding [0] to the file name, but load times seem to be roughly the same as if I don't use it.

Maybe there's another bottleneck?
What I do right now is open the image, run it through some algorithms, and then I split it into 512x512 tiles. For every row in a tile I call getPixels to get an array of pixels for that row, then I process the pixels and write them in the format the cache file expects. I don't think any of this could be a huge bottle neck, so that's left me suspecting that the image loading itself is slow. If there's nothing that can be done about it that's fine, I just thought I'd ask to see if I was doing something wrong.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Is there a way to speed up loading of a psd file?

Post by magick »

ImageMagick internal algorithms are most likely faster than getPixels(), perhaps you can use crop() to extract image tiles. Also make sure you have a modern release of ImageMagick, the current is 6.4.7-4, which has a number of performance enhancements including OpenMP support to take advantage of multiple cores.
Post Reply