{ "info": { "author": "Johannes Baiter", "author_email": "johannes.baiter@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "=============\njpegtran-cffi\n=============\n.. image:: https://travis-ci.org/jbaiter/jpegtran-cffi.png?branch=master\n :target: https://travis-ci.org/jbaiter/jpegtran-cffi\n :alt: Build status\n\njpegtran-cffi is a Python package for fast JPEG transformations. Compared to\nother, more general purpose image processing libraries like `wand-py`_ or\n`PIL/Pillow`_, transformations are generally more than twice as fast (see\n`Benchmarks`_). In addition, all operations except for scaling are lossless,\nsince the image is not being re-compressed in the process. This is due to the\nfact that all transformation operations work directly with the JPEG data.\n\nThis is achieved by using multiple C routines from the Enlightenment project's\n`epeg library`_ (for scaling) and *jpegtran* from the Independent JPEG Group's\n`libjpeg`_ library (for all other operations). These routines are called from\nPython through the `CFFI`_ module, i.e. no external processes are launched.\n\nThe package also includes rudimentary support for getting and setting the EXIF\norientation tag, automatically transforming the image according to it and\nobtaining the JFIF thumbnail image.\n\njpegtran-cffi was developed as part of a web interface for the `spreads`_\nproject, where a large number of images from digital cameras had to be prepared\nfor display by a Raspberry Pi. With the Pi's rather slow ARMv6 processor, both\nWand and PIL were too slow to be usable.\n\n.. _wand-py: http://wand-py.org\n.. _PIL/PIllow: http://pillow.readthedocs.org\n.. _Benchmarks: http://jpegtran-cffi.readthedocs.org/en/latest/#benchmarks\n.. _epeg library: https://github.com/mattes/epeg\n.. _libjpeg: http://en.wikipedia.org/wiki/Libjpeg\n.. _CFFI: http://cffi.readthedocs.orgs\n.. _spreads: http://spreads.readthedocs.org\n\nRequirements\n============\n- CPython 2.6, 2.7, 3.3 or PyPy\n- cffi\n- libjpeg8 with headers (earlier versions will not work)\n\nInstallation\n============\n\n::\n\n $ pip install jpegtran-cffi\n\nUsage\n=====\n::\n\n from jpegtran import JPEGImage\n\n img = JPEGImage('image.jpg')\n\n # JPEGImage can also be initialized from a bytestring\n blob = requests.get(\"http://example.com/image.jpg\").content\n from_blob = JPEGImage(blob=blob)\n\n # Reading various image parameters\n print img.width, img.height # \"640 480\"\n print img.exif_orientation # \"1\" (= \"normal\")\n\n # If present, the JFIF thumbnail can be obtained as a bytestring\n thumb = img.exif_thumbnail\n\n # Transforming the image\n img.scale(320, 240).save('scaled.jpg')\n img.rotate(90).save('rotated.jpg')\n img.crop(0, 0, 100, 100).save('cropped.jpg')\n\n # Transformations can be chained\n data = (img.scale(320, 240)\n .rotate(90)\n .flip('horizontal')\n .as_blob())\n\n # jpegtran can transform the image automatically according to the EXIF\n # orientation tag\n photo = JPEGImage(blob=requests.get(\"http://example.com/photo.jpg\").content)\n print photo.exif_orientation # \"6\" (= 270\u00b0)\n print photo.width, photo.height # \"4320 3240\"\n corrected = photo.exif_autotransform()\n print corrected.exif_orientation # \"1\" (= \"normal\")\n print corrected.width, corrected.height # \"3240 4320\"\n\n\nFor more details, refer to the `API Reference`_.\n\n.. _API Reference: http://jpegtran-cffi.readthedocs.org/en/latest/#api-reference\n\nBenchmarks\n==========\nAll operations were done on a 3.4GHz i7-3770 with 16GiB of RAM and a 7200rpm\nHDD with the following 2560x1920 8bit RGB JPEG:\n\nhttp://upload.wikimedia.org/wikipedia/commons/8/82/Mandel_zoom_05_tail_part.jpg\n\n.. figure:: http://jpegtran-cffi.readthedocs.org/en/latest/_images/benchmark.png\n\n Both wand-py and PIL were run with the fastest scaling algorithm available,\n for wand-py this meant using ``Image.sample`` instead of ``Image.resize``\n and for PIL the nearest-neighbour filter was used for the ``Image.resize``\n call.\n\n Benchmark source: https://gist.github.com/jbaiter/8596064\n\n\nLicense\n=======\nThe MIT License (MIT)\n\nCopyright (c) 2014 Johannes Baiter \n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\nof the Software, and to permit persons to whom the Software is furnished to do\nso, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/jbaiter/jpegtran-cffi.git", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "jpegtran-cffi", "package_url": "https://pypi.org/project/jpegtran-cffi/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/jpegtran-cffi/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/jbaiter/jpegtran-cffi.git" }, "release_url": "https://pypi.org/project/jpegtran-cffi/0.5.2/", "requires_dist": null, "requires_python": null, "summary": "Extremly fast, (mostly) lossless JPEG transformations", "version": "0.5.2" }, "last_serial": 1560208, "releases": { "0.3": [ { "comment_text": "", "digests": { "md5": "c7b945d8073dac3a7a80f03dba424250", "sha256": "41f6168f4bf36c02fbe4bee534b49da827fc285132b6dc116ddfdced98567122" }, "downloads": -1, "filename": "jpegtran-cffi-0.3.tar.gz", "has_sig": false, "md5_digest": "c7b945d8073dac3a7a80f03dba424250", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 59157, "upload_time": "2014-01-23T23:08:10", "url": "https://files.pythonhosted.org/packages/06/3d/2234d92dcb561662da2ff26b4fc51b8ff4e8dccbb3c81b5e1f3d912b8f40/jpegtran-cffi-0.3.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "7e23e9d9382a5a0f56118d893984e333", "sha256": "5ec40a80302fd4addd1e950d57427dec006a68f524429bcc8821497522fd50b1" }, "downloads": -1, "filename": "jpegtran-cffi-0.3.1.tar.gz", "has_sig": false, "md5_digest": "7e23e9d9382a5a0f56118d893984e333", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 49860, "upload_time": "2014-01-24T14:24:21", "url": "https://files.pythonhosted.org/packages/6b/72/41b1d5c046576b615ee1e5854f84bc5a7664f04d63a92b0191defe437e2b/jpegtran-cffi-0.3.1.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "daec85f5c0aed76499d78dc238ef6223", "sha256": "f8f90f08dc72cf416967ad99dc22099acd61c4cc1bb37922e2eb22e9767a0b2e" }, "downloads": -1, "filename": "jpegtran-cffi-0.4.tar.gz", "has_sig": false, "md5_digest": "daec85f5c0aed76499d78dc238ef6223", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 50411, "upload_time": "2014-02-11T09:17:10", "url": "https://files.pythonhosted.org/packages/06/7a/05517de2518998baf3ce30a23146605cd60acb95436e77ed852066cbf047/jpegtran-cffi-0.4.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "ef174ea4d8eec30b14cf9142cef37fe0", "sha256": "2acb04651d7428f1cc64b35754a15c64d112ef93f129340cbdf5f40db3d68c80" }, "downloads": -1, "filename": "jpegtran-cffi-0.5.tar.gz", "has_sig": false, "md5_digest": "ef174ea4d8eec30b14cf9142cef37fe0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 42306, "upload_time": "2014-05-10T15:32:34", "url": "https://files.pythonhosted.org/packages/ec/66/c4eb8531c11db4880140a73516d36e59b72a92708af4d33b958bce512995/jpegtran-cffi-0.5.tar.gz" } ], "0.5.1": [ { "comment_text": "", "digests": { "md5": "efc59a1fce478d5f18164c95d24e50ef", "sha256": "8cfb719f93bdccbcbb1a2af88465f00cbc97d665d37ebe0d9587affb5a8c71bf" }, "downloads": -1, "filename": "jpegtran-cffi-0.5.1.tar.gz", "has_sig": false, "md5_digest": "efc59a1fce478d5f18164c95d24e50ef", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 150711, "upload_time": "2014-10-21T09:49:49", "url": "https://files.pythonhosted.org/packages/ef/80/28204e7d25aa2a700d189e25ca76d9268ff320d5780bb6a2d4622fd8c410/jpegtran-cffi-0.5.1.tar.gz" } ], "0.5.2": [ { "comment_text": "", "digests": { "md5": "00420ff71fbc4da8d482c678138a9888", "sha256": "7d2e90c00903f21f43f30f0723c709403add0524d29a16b39b02311382553eae" }, "downloads": -1, "filename": "jpegtran-cffi-0.5.2.tar.gz", "has_sig": false, "md5_digest": "00420ff71fbc4da8d482c678138a9888", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 138433, "upload_time": "2015-05-24T10:17:26", "url": "https://files.pythonhosted.org/packages/e5/0e/0caacf608078fc9ec3236f6ccf886dead28519e83a1d536144571ee12ed6/jpegtran-cffi-0.5.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "00420ff71fbc4da8d482c678138a9888", "sha256": "7d2e90c00903f21f43f30f0723c709403add0524d29a16b39b02311382553eae" }, "downloads": -1, "filename": "jpegtran-cffi-0.5.2.tar.gz", "has_sig": false, "md5_digest": "00420ff71fbc4da8d482c678138a9888", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 138433, "upload_time": "2015-05-24T10:17:26", "url": "https://files.pythonhosted.org/packages/e5/0e/0caacf608078fc9ec3236f6ccf886dead28519e83a1d536144571ee12ed6/jpegtran-cffi-0.5.2.tar.gz" } ] }