-
Notifications
You must be signed in to change notification settings - Fork 312
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
Add support for thumbnailing SVG images #560
Conversation
…into svg-support # Conflicts: # CHANGES.rst # easy_thumbnails/signals.py # tox.ini
# Conflicts: # CHANGES.rst # easy_thumbnails/__init__.py
Are there any news about this PR? |
easy-thumbnails already supports SVG images. Please try using this version: https://pypi.org/project/easy-thumbnails/2.8rc0/ If you use django-filer there is a release which uses these new features: https://pypi.org/project/django-filer/2.1rc3/ I never got any feedback on this new feature, therefore I forgot to create a production release of the above packages. |
Ok, we will test it when we have time and give you feedback so that you can have production package. |
Ok, I manage to integrate some things but failed on others
|
Hello. I understand correctly that now it is not possible to load svg or bitmap in ThumbnailerImageField. Only raster is supported. Or I didn’t understand something. I'm watching version 2.8rc0 Perhaps a different workflow is expected? |
@jrief can you please tell how to test this rc and accept svg files through ThumbnailerImageField? installing easy-thumbnails==2.8rc0 |
@jrief have you considered releasing VIL as a standalone package and then adding it as a dependency to easy-thumbnails? It seems like a more generally useful project that shouldn't be hidden inside a submodule of easy_thumbnails. This PR also contains a number of unrelated changes, which makes it harder to review. Is this because you decided to use this branch as a base for the pre-release? I believe it's bad form to pre-release an unmerged (and unreviewed) branch, I would have expected at least some involvement of the original project owner (@SmileyChris). |
Actually no. Reason is, that "VIL" just mimics the behaviour of PIL without transforming the images SVG themselves. Well sort of, by changing the the coordinates inside the SVG viewbox, one can "crop" an SVG image. But I don't see any usage of that mimicking behaviour outside easy-thumbnails.
A requirement of the organization I am working for was to support SVG images by django-filer. With the changes in this PR, I came up with a working solution. Therefore I needed a pre-release. I asked a few people to review django-filer together with this version of easy-thumbnails, but got little feedback. I heavily welcome you to review the changes I have made, so that I can release SVG support officially. The best way of doing this is via https://pypi.org/project/django-filer/2.1rc3/ Apparently one has to release an official version, before people start yelling, that you broke something which used to work for them. |
# Conflicts: # .travis.yml # CHANGES.rst # easy_thumbnails/__init__.py # tox.ini
Add support for thumbnailing SVG images.
Of course it doesn't make sense to thumbnail SVG images, because being in vector format they can scale to any size without any quality of loss. However, users of easy-thumbnails may want to upload and use SVG images just as if they would be PNG, GIF or JPEG. They don't necessarily care about the format and definitely don't want to convert them to a pixel based format. What they want is to reuse their templates with the templatetag
thumbnail
and scale and crop the images to whatever their<img src="..." width="..." height="...">
has been prepared for.This is done by adding an emulation layer named VIL, which aims to be compatible with PIL. All thumbnailing operations, such as scaling and cropping behave like pixel based images. The final filesize of such thumbnailed SVG images doesn't of course change, but their width/height and bounding box may be adjusted to reflect the desired size of the thumbnailed image.