-
Notifications
You must be signed in to change notification settings - Fork 43
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
Predict dimensions for img tag #16
Comments
Code to do it with .png: http://stackoverflow.com/questions/8032642/how-to-obtain-image-size-using-standard-python-class-without-using-external-lib You have to read only some file headers. |
Also, PIL does not load the image to memory on |
PIL doesn't require loading the image on So I guess we need to see how PIL[low] behaves with the other formats, and if it doesn't actually load the data (from valid files) then I'm cool with just using PIL to do it. Otherwise, it sounds like a good idea for another small library. ;) |
This is underway now as it is required for the implementation of "retina" support for my personal site. |
This is done in the "retina" branch. |
It would be swell if we could predict the final width/height of an image so that they can be used in the template as well (to avoid a jump in layout when the images load).
Perhaps something like:
would render into:
Some testing needs to be done with regards to the speed at which dimension data can be extracted from images on disk without loading all of the data, so that we know if we can get away with the naive implementation or if we have to intelligently cache dimensions.
The text was updated successfully, but these errors were encountered: