Giter Club home page Giter Club logo

uneven_pixel_compression's Introduction

Uneven pixels compression

The project consists of compressing images using pixels of different sizes. By doing so, several hundreds of pixels are cramped into a big one that is more or less the same color as the whole chunk.

The image is analised as candidate for a single big pixel using the variance of the color of the pixels. If the variance is greater than a certain threshold, then the candidate pixel is divided into two and each of them is analised and the process goes on until the pixels can't be split anymore.

The project contains five files: blockpixel.py, codec.py, misc.py, visualizer.py and viewer.py.

codec.py contains the functions used to write a compressed image into a file (e.g. encode_file()), to read the file and get the pixels that make the image (e.g. function decode_file()), and to transform that list of big pixels into a string image (e.g. function to_string()).

misc.py initializes global variables and contains the class Bloque, which is what each pixel is represented with.

visualizer.py is used in case an animation of the pixels appearing in order is wanted. It depends on pygame.

viewer.py only displays a .dpi file.

The whole project uses PIL and numpy.

blockpixel.py is the main program. It takes up to five arguments and the image file to convert. The options it takes are:

  • -t value for changing the threshold and get a more detailed image.
  • -m value for changing the minimum size the pixels can take.
  • -v for verbose mode.
  • -V for visualization of the animation.

uneven_pixel_compression's People

Contributors

albertoibm avatar

Watchers

James Cloos avatar  avatar

uneven_pixel_compression's Issues

pygame exception

It want to import the image even if I didn't specify the visualize option.

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.