Coder Social home page Coder Social logo

saga64 / img4web Goto Github PK

View Code? Open in Web Editor NEW

This project forked from joedicastro/img4web

0.0 1.0 0.0 118 KB

This Script optimizes .jpg and .png images for the web. This follows the "Yahoo Best Practices for Speeding Up Your Web Site" about optimize images. http://developer.yahoo.com/performance/rules.html#opt_images

License: GNU General Public License v3.0

Python 100.00%

img4web's Introduction

img4web

A python script to optimize .jpg, .png and animated .gif images for the web.

This follows the "Yahoo Best Practices for Speeding Up Your Web Site" about optimize images.

After run it, you have a lossless optimization for the images. A small size saving for each image, but speeds up the load of web pages and reduces the bandwidth cost for a website.

Pre-Requisites & Dependencies

Obviously, first we need is python. If we are in Linux or Mac, usually is installed by default. If we are in Windows, download it from here.

The python version needed for run both scripts is 2.6

img4web.py only uses python standard library modules, no needs any other module.

External programs

Uses the program pngcrush, the command jpegtran of the libjpeg library and the program gifsicle.

In linux they are usually available in the most popular distribution repositories, e.g.: In debian, Ubuntu as these packages in their repositories: pngcrush & libjpeg-progs & gifsicle

For install them:

sudo aptitude install pngcrush
sudo aptitude install libjpeg-progs
sudo aptitude install gifsicle

In Windows pngcrush can be downloaded at here, libjpeg can be downloaded (as gnuwin32) at here and gifsicle can be downloaded at here

This had been tested in linux and Windows. Sorry, I don't have a Mac.

Using them

You need to run this script into the folder where are stored that images you want to optimize.

Run the script is very simple,

in linux

python img4web.py

in windows

(path where you have installed python)\python.exe img4web.py

At the end, there's a new subdirectory called processed where are stored the new processed images.

That's all! Simple, fun and fast!

Features

After the execution it shows a little report about the image weight savings by type.

It looks like that

============================================================================
                                    Summary
============================================================================
         Original            Processed           Save

.jpgs:   ( 31)  2.12 MiB     ( 31)  1.82 MiB     301.28 KiB
.pngs:   ( 10)489.46 KiB     ( 10)368.93 KiB     120.53 KiB
.gifs:   (  4)952.71 KiB     (  4)796.06 KiB     156.66 KiB
----------------------------------------------------------------------------
Total:   ( 45)  3.53 MiB     ( 45)  2.96 MiB     578.47 KiB

How to get them

The code is hosted in a Git repository at GitHub, use this to get a clone:

git clone git://github.com/joedicastro/img4web.git

Contribution

Contributions and Feedback are most welcome. To contribute to the improvement and development of this scripts, you can send suggestions or bugs via the issues.

License

The script is distributed under the terms of the GPLv3 license

Apologies for any misspelling or syntax error, English isn't my mother tongue.

img4web's People

Contributors

joedicastro avatar

Watchers

James Cloos 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.