DEV Community

Discussion on: Pixxia - Compress your Images in Optimal Quality for FREE

Collapse
iamkarshe profile image
Utkarsh Kumar Raut

Nice, we somehow use the same PIL/Pillow at our eCom cronjob for compression.

Magic starts at settings.py line number 49.

github.com/dhhruv/Pixxia/blob/6d9e...

Collapse
dhhruv profile image
Dhruv Panchal Author

Yeah @iamkarshe that's right, that's where the magic starts. And it's interesting to hear that it has been implemented somewhere else. If you've worked in this domain then is there anything you can suggest to make this better ?? It'd help.

Collapse
iamkarshe profile image
Utkarsh Kumar Raut

I will share my use case see if any point you can pick up.

  1. We have Python script which mostly runs via cron — it takes original media ref. from database.
  2. Make three versions of original images, <image>_low.jpg, <image>_sd.jpg & <image>_hd.jpg using various parameters in PIL optimize &quality factor. Also we reduce width & height for creating low-resolution images.
  3. Later, we do add some copyright text (this is client-dependent feature).
  4. Send images again to S3 where it is serving to app/web via Cloudfront.
  5. Lately we exposed API via Flask for client blogs & eCom where on-the fly media are now being compressed & stored.

Update

  1. We are now started to use .webp for newer compression.

Now to your original question,

  1. You can definitely make it as web-api-like-app so developer can use it for batch compression/processing.
  2. User can apply filters via same API, for example grayscale image with 60% quality and 400 x 300 can be on the fly requested as pixxia-app.io/<image-uuid>?filter=gray&quality=60&width=400&height=300.

Let me know your thoughts.

Many powers.

Thread Thread
dhhruv profile image
Dhruv Panchal Author

Yeah, I've seen some engines like that. May work but still a lot of work has to be done from what you answered. Might wanna look into that. Thanks.