Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image Save Fallback To make_blob Is Very Slow #143

Closed
mdallen22 opened this issue Aug 26, 2013 · 3 comments
Closed

Image Save Fallback To make_blob Is Very Slow #143

mdallen22 opened this issue Aug 26, 2013 · 3 comments

Comments

@mdallen22
Copy link
Contributor

@mdallen22 mdallen22 commented Aug 26, 2013

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.

@dahlia
Copy link
Collaborator

@dahlia dahlia commented Aug 27, 2013

I could’t any better way to write it to file-like objects that don’t have fd (via .fileno() method) e.g. io.BytesIO, StringIO.StringIO etc. Any ideas?

@mdallen22
Copy link
Contributor Author

@mdallen22 mdallen22 commented Aug 27, 2013

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.

@dahlia
Copy link
Collaborator

@dahlia dahlia commented Aug 28, 2013

See also #145.

@dahlia dahlia closed this in 93341d1 Sep 9, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants