Giter Club home page Giter Club logo

jpegio's Introduction

JpegIO

A python package for accessing the internal variables of JPEG file format such as DCT coefficients and quantization tables.

Installation

It is recommended to install by compiling yourself. The installation process includes compiling C/C++ source codes.

python setup.py install

You can also use the pre-compiled wheels (If some errors occur, try compiling the package using the above command).

On Linux:

pip install dist/jpegio-x.x.x-cp3x-cp3x-linux_<your architecture>.whl

On Windows 10 x64:

pip install dist/jpegio-x.x.x-cp3x-cp3x-win_amd64.whl

On macOS x64:

pip install dist/jpegio-x.x.x-cp3x-cp3x-macosx_<version>_x86_64.whl

Making a wheel

You can use the following command for making a wheel for your own architecture such as x64 or ppc64le.

python setup.py bdist_wheel

The cooked wheel files are located at dist directory.

Dependency

This package requires other packages.

Usage example

import jpegio as jio

jpeg = jio.read("image.jpg")
coef_array = jpeg.coef_arrays[0]  
quant_tbl = jpeg.quant_tables[0]

# Modifying jpeg.coef_arrays...
# Modifying jpeg.quant_tables...

jio.write(jpeg, "image_modified.jpg")
  • coef_arrays is a list of numpy.ndarray objects that represent DCT coefficients of YCbCr channels in JPEG.
  • quant_tables is a list of numpy.ndarray objects that represent the quantization tables in JPEG.

You can also utilize other variables (one of the simplest ways for finding them is to use dir(img)). The names of member variables have been determined following the convention of libjpeg.

References

License

Apache License 2.0

jpegio's People

Contributors

dwgoon 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.