Coder Social home page Coder Social logo

imagy's Introduction

Imagy - make your website's images load up to 50% faster ===============

Imagy is a file daemon, that watches your website's media root (where your images are stored) and automatically optimizes image files that are created or modified within.

Imagy uses lossless compression, so your users never have to load unnecessary bytes. Your images look the same, but load faster.

Getting Started

Imagy relies on a few select binaries to perform image optimization. On Ubuntu (tested on 11.10) you can install everything with:

sudo apt-get install pngnq pngcrush imagemagick gifsicle libjpeg-progs

pip install imagy

That's it.

Running it for the first time -----------------

A lot of work has gone into making it set-and-forget. If you're running it for the first time, this command should be all you need: :

imagy /awesome/images/

Imagy will run through the directory /awesome/images/ and all its subdirectories and optimize all image files it finds. After that it will watch these directories for images that get created or modified.

The algorithms used are stable (don't further modify files after multiple invocations), however to make trying Imagy out as easy as possible, the default is to keep original files around for later reversal. For example the file /file.jpg would be copied to /file-original.jpg before optimization. If the optimized fileis not smaller than the original, no copy gets stored and the original file remains unchanged.

Further Usage

If after some time you wish to stop using Imagy, run imagy --revert which will move all original images back to their initial location.

If you have (rightfully) come to the conclusion that you don't really need to keep originals around, set KEEP_ORIGINALS in config.py to False. If you want to delete all already stored originals run imagy --deloriginals.

Credits

In the background Imagy uses the awesome library smush.py which exposes a general interface to handle the various file types.

Notes

I use Imagy in production at sc2wow.com. I was able to save 150kB off my frontpage load, saving anywhere from 5% to 50% per image, though your results may differ.

More information on how to install pip

Dependencies

  • imagemagick
  • gifsicle
  • jpegtran (on ubuntu in libjpeg-progs)

- pngcrush .. - pngnq

imagy's People

Watchers

James Cloos avatar Mitesh Shah avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.