Page 1 of 1

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

Posted: 2008-12-09T06:19:32-07:00
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. =)

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

Posted: 2008-12-09T07:15:28-07:00
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.

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

Posted: 2008-12-09T08:11:06-07:00
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.

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

Posted: 2008-12-09T09:43:34-07:00
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.