Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Image Save Fallback To make_blob Is Very Slow #143
When saving an image with the file parameter, if the file is not an instance of file_types, image.make_blob is written to the file stream instead of calling MagickWriteImageFile. This is very heavy for large images. A work around may be to create a temporary file, call MagickWriteImageFile on the temporary file, and then move the contents of the temporary file to the permanent file. I am willing to implement this and test out the performance increases when I have free time.
After some more time with this, the problem does not appear to be with make_blob but with a bug when saving animated gifs to a file object. If you save an animated gif using the file parameter only the last frame of the image is saved. The speed increase I was seeing when using a temporary file to bypass make_blob was not because make_blob was slow, but because MagickWriteImageFile was only saving one frame of the animation.
I fixed this bug here #144. This branch was off of 0.3-maintenance. If you would like me to branch off of master instead, let me know.