Code Monkey home page Code Monkey logo

jpeg-compressor's Introduction

JPEG-COMPRESSOR

This algorithm is a theoretical modification to the preexisting JPEG algorithm for reduced file sizes. The lossless entropy algorithm uses bZip2 (bz2) rather than the usual run-length encoder (RLE) and huffman tree. The algorithm incorporates the use of Structural Similarity Index Measurement (SSIM) to discard redundant coefficients to the human eye.

See SETUP section on how to get started.

Recent Additions

6.10

You can now save the image as a compressed JPEG. The JPEG won't be as small as a bz2 file but will be smaller than the original JPEG. This compressor should also outperform Google's Guetzli. The compressed JPEG will allow you to transfer JPEG files quicker and using less bandwidth. The compressed JPEG is also compatible with all OS. Disclaimer: compressed JPEG file contains NO metadata. You can delete the original file at your own discretion.

6.28

You can run compression and decompression on entire folders. Use compressfolder.py and decompressfolder.py.

7.22

Updated to use parallel processing for improved runtimes.

Setup

Check dependencies at bottom of README

For compress.py example usage:

python compress.py [-i | Full image path with file and extension] [-c | Path to folder where to save compressed file/default=working directory]

For decompress.py example usage:

python decompress.py [-i | use letter y to save image as jpeg/default=letter n to denote that save the image as a png] [-c | Path to compressed file with extension (.bz2)] [-d | Save the image to specified folder/default=working directory]

For compressfolder.py example usage:

python compressfolder.py [-i | folder of images] [-c | where to store compressed files]

For decompressfolder.py example usage:

python decompressfolder.py [-c | folder of compressed images] [-d | directory to store decompressed images for viewing]

Use -h for full details.

Explanations

All file data is saved within the bz2 file. The PNG file that is saved when decompressed is for VIEWING PURPOSES. You can delete the PNG file and original after viewing, all image data is in the bz2 file. When comparing file sizes, compare the bz2 file to the original image (JPEG file).

Deleting the original image is not recommended

Though it is mentioned above, it is not recommended. There is NO meta data in the bz2 file. Furthermore, this algorithm is theoretical, 1. there may be bugs and 2. no OS can unwrap a bz2 file and decompress automatically into a viewable image. You need to use the provided decompressor to decode the specific sequence of values.

Like mentioned, this is a completely novel compression algorithm.

Future Works

Using DNN to compress files smaller by outputting optimal quantization tables.

Dependencies & Purposes:

  • imageio (for opening image files and saving)
  • tqdm (make UI layout nicer with progess bars)
  • scipy (running JPEG's DCT {2d})
  • numpy (makes matrix mathematics easier)
  • time (timer for length of algorithm)
  • scikit-image (SSIM metric quality)

jpeg-compressor's People

Contributors

johnathanchiu avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

rawan-samara

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.