django-imagekit icon indicating copy to clipboard operation
django-imagekit copied to clipboard

Using postprocessor like jpegoptim or optiping?

Open jhancia opened this issue 6 years ago • 1 comments

Thank you for this very useful package. I want to have a thumbnail generated when user uploads a file, probably using celery. I see we can set the general quality and size. Wondering if it's possible to also run the thumbnail through a postprocessor optimizer like jpegoptim or optipng? These can apparently reduce the file size by almost 50% (read about this in another package). Is this easy to do/any guidance on how to do this?

jhancia avatar Dec 27 '18 06:12 jhancia

This should probably be possible with custom processor, but I'm not sure what will happens if Pillow is opening optimized image and then save it to another file. Will it preserve the optimizations or thy will be loosed? These optimizers are working on file on the filesystem right? If so then using them in ImageKit can be somehow suboptimal:

  1. store the resulting image in temp file;
  2. run the optimizer;
  3. Open the resulting image and return it from the processor.

But if this is ok then why not. You can try to create custom processor for your project which will do the same, and then share the result with us ;)

vstoykov avatar Feb 05 '19 23:02 vstoykov