{ "info": { "author": "Eric Schwimmer", "author_email": "git@nerdvana.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: System Administrators", "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Multimedia :: Graphics :: Graphics Conversion", "Topic :: Multimedia :: Graphics :: Presentation" ], "description": "Dirpy - A dynamic image modification tool\n=========================================\n\nDirpy is a Python daemon that can be used anywhere that a developer (or\na user) requests an image of arbitrary width and/or height. This can be\nuseful in having responsive pages adapt to different viewport sizes\n(i.e. to the display sizes of newly released mobile devices), as well as\nin allowing for rapid development of new graphic elements.\n\nBy doing so, it can replace all images that are statically derived from\na single source image (e.g. thumbnail photos). When combined with a\nuser-facing proxying webserver, this can greatly ease the load on both\ndevelopers and system administrators by reducing the number of\nderivative images that need to be manually generated, as well as\nreducing the disk space required to store them.\n\nA few of Dirpy's more interesting capabilities include:\n\n- Modifying a source image on the fly by applying one or more\n modification commands, including:\n\n - Resizing/shrinking/enlarging with multiple different size/aspect\n controls\n - Padding images, with support for transparency\n - Cropping images, with intelligent border detection\n - Image transposition (i.e. rotation, horizontal & vertical\n flipping)\n\n- Seamless conversion between different input & output image formats\n- Loading source images from disk, remote HTTP proxy, and user POST\n data\n- Saving output images to disk (useful when acting as a LRU image\n cache)\n- JPEG ICC profile support\n- Running in a standalone configuration or via UWSGI\n- Ability to report statistics to a StatsD daemon\n- Caching of results in a redis backend or redis cluster\n\nA full list of Dirpy's commands and their options is available in the\n`Dirpy API\nGuide `__.\n\nRequirements\n------------\n\nDirpy requires a semi-recent version of Python (at least Python 2.6 or\ngreater), and supports Python 3.\n\nIt also requires the PIL library, as provided by the `Pillow\nfork `__. Before Pillow is compiled and\ninstalled, you should ensure that the host machine has both the standard\nand development packages of the image formats that you want to support\ninstalled, i.e.:\n\n- JPG library & development files (called libjpeg-turbo in\n RedHat/Centos)\n- PNG library & development files (called libpng in RedHat/Centos)\n- GIF library & development files (called giflib in RedHat/Centos)\n\nAll libraries to be used by Pillow must be installed prior to Pillow\nitself, as PIL compiles against and links to these libraries as part of\nits installation process. For a full list of the image files that Pillow\n(and subsequently Dirpy) supports, see\n`here `__.\n\nInstallation\n------------\n\nSince Dirpy is available as a PyPI module, if you have\n`pip `__ available,\ninstallation should be as simple as:\n\n::\n\n pip install dirpy\n\nThis should install Dirpy and all of its required Python modules. If you\n*must* have the absolute latest and greatest, you can install directly\nfrom this repo:\n\n::\n\n pip install https://github.com/redfin/dirpy/zipball/master\n\nConfiguration\n-------------\n\nDirpy's configuration file is fairly succint; you can find a documented\nconfiguration file\n`here `__.\n\nRunning\n-------\n\nDirpy can be run either as a standalone daemon, or as a uWSGI vassal\n(which is recommended; see `here `__\nfor more info).\n\nWhen running under uWSGI, you can use the .ini in the\n`extras `__\ndirectory to launch Dirpy. Otherwise, consider running Dirpy as a daemon\nvia systemd (there's also a file in the extras directory for this) or\nsysV init.\n\nWhen run from the command-line, Dirpy supports the following options:\n\n-h, --help show this help message and exit -c CONFIG\\_FILE,\n--config-file CONFIG\\_FILE Path to the Dirpy config file -d, --debug\nEmit debug output -f, --foreground Don't daemonize; run program in the\nforeground\n\nUsage\n-----\n\nDirect Dirpy Access\n~~~~~~~~~~~~~~~~~~~\n\nWhen accessing Dirpy directly (i.e. not through a web proxy), a remote\nclient can exercise the full power of Dirpy (which can be a blessing and\na curse, as a savvy and malicious remote user could use it to wreak\nhavoc).\n\nBelow are some example Dirpy URLs, along with explanations as to how\nthey would cause Dirpy to behave:\n\nhttps://127.0.0.1:3000/path/to/my/file.jpg?resize=300x200,shrink\n\nThis url will use the file \"/path/to/my/file.jpg\" as the source file.\nThe file should be located on the local machine inside the Dirpy HTTP\nroot, which defaults to the \"/var/www/html\", so the fully qualified path\n(assuming a default config) would be\n\"/var/www/html/path/to/my/file.jpg\". The file will be resized to a width\nof 300 pixels and a height of 200 pixels, preserving aspect ratio, but\nnot enforcing a strict adherence to the requested image size (due to the\nlack of distort, pad or crop options). So if \"file.jpg\" in this example\nwas a 1000x1000 image, it would be resized to 200x200, instead of\n300x200.\n\nhttps://127.0.0.1:3000/this/photo.jpg?resize=200x,grow&save=fmt:png\n\nThis url will use a source file whose fully qualified path (as above)\nwould be \"/var/www/html/this/photo.jpg\", and which will be enlarged to a\nwidth of 300 pixels with an aspect-ratio-scaled height. So a 150x100\npixel source file would be resized to 300x200. However, since this url\nspecifies the grow option, source files with widths greater than or\nequal to 300 pixels will be passed through un-resized (although options\nsuch as quality and output format will still be obeyed). The resulting\nimage will be returned as a PNG.\n\nhttps://127.0.0.1:3000/a/b.jpg?resize=200x400,fill&crop&save=fmt:jpg,optimize,qual:93\n\nThis url will use the photo.jpg source file, resize it to 200x400,\nfilling (with overlap) the bounding box. It will then crop the image to\n200x400 (since the crop command will inherit the dimensions from the\nprevious resize command) and then output the image as an optimize JPEG\nwith a compression quality of 93%. So, for a 1000x1000 source image, it\nwould first be resized to 400x400 (aspect ratio preserved, filling\nbounding box) and then center-cropped to 200x400.\n\nhttps://127.0.0.1:3000/this/photo.jpg?crop=border,symmetric&resize=150%\n\nRemove any border surrounding the photo.jpg source file, and then\nincrease its size by 50%.\n\nhttps://127.0.0.1:3000/?load=post&resize=200x&save=todisk:myfile.jpg,noshow\n\nLoad an image from POST (thus no on-disk path is required), resize to\n200 pixels wide, save it to /myfilename.jpg, and send no image data back\nto the requestor.\n\nProxying through a web server\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nIf you are exposing Dirpy's functionality to the greater internet, it is\n*strongly* recommended that you meter user's access to Dirpy via a\nproxying webserver. This is the use case that Dirpy was originally\ndesigned for, and will prevent remote users from performing any sort of\nmischief (which will most certainly happen if a proxying web server\nisn't used).\n\nAn example of using Nginx to proxy a user request to Dirpy:\n\n::\n\n location ~ ^/thumbnail/(.+\\.jpg)$\n {\n add_header Cache-Control \"public\";\n proxy_pass http://127.0.0.1:3000/src_photo/$1?resize=64x64,fill&crop;\n }\n\nThis will cause any request for an incoming url that matches\n``/thumbnail/*.jpg`` to be proxied to a backend Dirpy server (which\nyou've restricted access to via a local firewall or other means,\nright?), which will then generate a 64x64 thumbnail using the\ncorresponding file located in ``/src_photo``.\n\nPerformance tweaks\n------------------\n\nDirpy can scale linearly with the number of processors on the host\nmachine, and CPU is by far its most important resource (faster/more CPUs\n= more Dirpy requests/second). Play around with the number of configured\nDirpy workers until you find the happy medium between Dirpy\nrequests/second and server responsiveness).\n\nAlso, considering using the\n`Pillow-SIMD `__ fork, as it\noffers some impressive speed benefits over the standard Pillow module\n(especially if you have a processor that supports AVX2 extensions). To\nuse Pillow-SIMD, install Pillow-SIMD first, and then install Dirpy with\nno dependencies:\n\n::\n\n pip install Pillow-SIMD\n pip install --no-deps dirpy\n\nIf you have already installed Dirpy, and wish to switch to Pillow-SIMD,\njust uninstall Pillow and install Pillow-SIMD in its place:\n\n::\n\n pip uninstall Pillow\n pip install Pillow-SIMD\n\nDirpy also supports caching results in a redis backend or redis cluster\nvia the ``redis`` Python module, which you will need to install prior to\nbeing able to use this function:\n\n::\n\n pip install redis\n\nEnabling redis support in Dirpy is trivial; see the config for details.\nNote, however, that POST requests won't be served from (or written to)\nthe redis server.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/redfin/dirpy", "keywords": "sprite generator", "license": "Apache 2.0", "maintainer": null, "maintainer_email": null, "name": "dirpy", "package_url": "https://pypi.org/project/dirpy/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/dirpy/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/redfin/dirpy" }, "release_url": "https://pypi.org/project/dirpy/1.3.0/", "requires_dist": null, "requires_python": null, "summary": "A dynamic image modification proxy", "version": "1.3.0" }, "last_serial": 5579566, "releases": { "0.5": [ { "comment_text": "", "digests": { "md5": "44b183c1126d832c21a31c22997175eb", "sha256": "b23a3c50f399c1fb7993cc7be3877f92256b2df20649d0f7744ce93944d7bc26" }, "downloads": -1, "filename": "dirpy-0.5.tar.gz", "has_sig": false, "md5_digest": "44b183c1126d832c21a31c22997175eb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 21990, "upload_time": "2016-08-28T16:13:46", "url": "https://files.pythonhosted.org/packages/1e/57/6cf2507c1618b04e70f62bdc7147c54de4d401a93470be3166472751b5f6/dirpy-0.5.tar.gz" } ], "0.6": [], "0.7": [ { "comment_text": "", "digests": { "md5": "3046e44e5bde095a56847cbf15d11916", "sha256": "c394b713e9b2cd109cfa369beb8e71fab3cff6432814fd03c4d3ba40a54600ca" }, "downloads": -1, "filename": "dirpy-0.7.tar.gz", "has_sig": false, "md5_digest": "3046e44e5bde095a56847cbf15d11916", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22248, "upload_time": "2016-09-20T19:17:16", "url": "https://files.pythonhosted.org/packages/79/a7/eb3f459a0f9d8feb1d945bf4511de9152027a2c532b8b9110c5d2782ab7c/dirpy-0.7.tar.gz" } ], "0.8": [ { "comment_text": "", "digests": { "md5": "b50a09e9b81f2247929089ed07d879c7", "sha256": "c55e6c1a250760f767de2f78a2bc8392c7858b02ed4ce8f572f24a04893ef229" }, "downloads": -1, "filename": "dirpy-0.8.tar.gz", "has_sig": false, "md5_digest": "b50a09e9b81f2247929089ed07d879c7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22259, "upload_time": "2016-09-20T19:22:23", "url": "https://files.pythonhosted.org/packages/c2/a9/f0e7c03e31ee8404d33d40958141965cca62191a4593f3ebdd64cd46e344/dirpy-0.8.tar.gz" } ], "1.2.3": [ { "comment_text": "", "digests": { "md5": "db893cda1f394933e43021942c1b51df", "sha256": "6024b9dd69409bb8faefac3aaf0405850d3ab007ed715b975eeb90c837f70a6d" }, "downloads": -1, "filename": "dirpy-1.2.3.tar.gz", "has_sig": false, "md5_digest": "db893cda1f394933e43021942c1b51df", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24514, "upload_time": "2016-11-07T21:49:41", "url": "https://files.pythonhosted.org/packages/d7/d0/c7fbe333defefe36aaf2251cf09f050b600ca5754125cac66356b2fc8e1e/dirpy-1.2.3.tar.gz" } ], "1.3.0": [ { "comment_text": "", "digests": { "md5": "55cd2b675d1a51c0870d303605c45246", "sha256": "24d592fb307815db21d0cb14d9f63bdf060440b8962a46b31fe86875e00af1c5" }, "downloads": -1, "filename": "dirpy-1.3.0.tar.gz", "has_sig": false, "md5_digest": "55cd2b675d1a51c0870d303605c45246", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24714, "upload_time": "2016-11-08T21:18:11", "url": "https://files.pythonhosted.org/packages/9d/38/87cdc11655f3799ebbb3f7f81184a8c8260635a22eaf7e27371c40b38e65/dirpy-1.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "55cd2b675d1a51c0870d303605c45246", "sha256": "24d592fb307815db21d0cb14d9f63bdf060440b8962a46b31fe86875e00af1c5" }, "downloads": -1, "filename": "dirpy-1.3.0.tar.gz", "has_sig": false, "md5_digest": "55cd2b675d1a51c0870d303605c45246", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 24714, "upload_time": "2016-11-08T21:18:11", "url": "https://files.pythonhosted.org/packages/9d/38/87cdc11655f3799ebbb3f7f81184a8c8260635a22eaf7e27371c40b38e65/dirpy-1.3.0.tar.gz" } ] }