2

I'm working on a photography website in Django.

Because the site is “responsive”, we pre-generate numerous sizes of each image using set aliases. In particular, 7 images with a variety of widths starting with 960 to 3,840 pixels wide in 480px increments. These images will be used when a photo is shown full-screen (as in, not in a list-view).

The site is also built for HiDPI/Retina displays/devices. So, we'd like to use the setting: THUMBNAIL_HIGH_RESOLUTION to automatically prepare the @2x versions of some of the aliases, but most notably, NOT for the aliases used to create the range of 7 images used for the full-screen images above.

As this project is meant to show off the work of a photographer, we're using rather high quality settings, so each image starts out at roughly 3840x2160 pixels in size and, through our pre-generation becomes approximately 50MBs of JPGs. Unfortunately nearly 50% of this is pure waste, because we only use the @2x versions on an image when we show lists or collections of images on a page. These are generally only 300px/600px wide and are relatively tiny compared to our "full screen" image sets.

We've considered disabling THUMBNAIL_HIGH_RESOLUTION and just creating new aliases for the @2x versions, but it isn't clear how to generate the correct filenames with an alias.

So, how can we pre-generate HiDPI/Retina images with the standard @2x (or _2x) infix for just SOME of our aliases?

UPDATE: This is now a feature of easy_thumbnails! In aliases you can use HIGH_RESOLUTION: False to disable their creation, or HIGH_RESOLUTION: True to force them. Thanks @ChrisSmiley!

mkoistinen
  • 7,724
  • 3
  • 41
  • 56
  • I came across similar issues using similar Django packages and recently decided to make my own library https://github.com/miki725/django-multires/tree/develop. It allows to automatically process subset of aliases (I call them recipes). But in case you will need to access the non-automatically processed images later on, it also can generate lazy urls which will process the image on request. Its still very fresh and lots of improvements to go in code and in docs but I would love any feedback/questions/contributions. – miki725 Feb 18 '14 at 00:22
  • @miki725 looks cool! I'm hoping for a solution using easy_thumbnails because its already a dependency for other apps we're using, but you're project looks like a fresh approach to this. I just starred it (I'm the first, apparently =) and will look into it for future projects. – mkoistinen Feb 18 '14 at 00:36

1 Answers1

2

In easy-thumbnails-1.3, the @2x infix currently is hard-coded, but in the next version, users may choose another infix through a configuration setting. Have a look at this pull request for details.

To answer your second question, currently it is not possible to generate Retina thumbnails only for certain entries. easy-thumbnails has a all-or-none policy, but this in theory, could be changed.

jrief
  • 1,516
  • 13
  • 9
  • Thanks, jrief. Looks like I'll have to find another way. – mkoistinen Feb 20 '14 at 14:19
  • 1
    Now in master you can can choose another infix via the ``THUMBNAIL_HIGH_RESOLUTION`` setting. You can also now generate (or not generate) Retina thumbnails per image by using the ``HIGH_RESOLUTION`` option in your alias / thumbnail tag. – SmileyChris Feb 22 '14 at 04:12