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

allow specifying access mode on image load functions #56

Merged
merged 5 commits into from
Jan 13, 2019

Conversation

toaster
Copy link
Contributor

@toaster toaster commented Dec 6, 2018

This allows specifying a different access mode on the three image loading functions NewImageFromBuffer, NewImageFromFile and LoadImage.

The sequential access mode allows the processing of huge images without writing temp data to the filesystem. On an AWS Lambda there are only 500MB temp space which limits the size of images processable using the random access mode.
For straight forward image resizing or cropping the sequential mode is sufficient.

I decided to extend the signatures of the loading methods (which affects existing code) instead of adding another three functions. Existing code can easily be fixed by adding nil for the load options.
Wrapping the access mode specification in a load options type allows for future extensions (like the modes in #26) without breaking the API again.

The usage of the mode is tested by exporting a test image twice. In random access mode this works while it fails in sequential access mode.

pkg/vips/image.go Outdated Show resolved Hide resolved
@toaster
Copy link
Contributor Author

toaster commented Dec 11, 2018

I changed to functors. Please have a look.

I also changed the Travis config to be able to run builds for forks.

@toaster
Copy link
Contributor Author

toaster commented Dec 19, 2018

Hi @davidbyttow,

Did you already had time to review the changes?

Best Regards

@davidbyttow davidbyttow merged commit df58c4d into davidbyttow:master Jan 13, 2019
@toaster toaster deleted the configurable_access branch January 13, 2019 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants