{ "info": { "author": "Nina Pavlich", "author_email": "nina@ninalp.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "# django-imagekit-cropper\nA library to enhance django-imagekit which allows you to specify your image variant crops:\n\n![CKEditor Dialog](https://raw.github.com/ninapavlich/django-imagekit-cropper/master/docs/screenshots/crop_screenshot.png)\n\n**InstanceSpecField** This is a class that extends ImageSpecField which passes the model instance to \nthe processors so that you can access other model fields to process the image.\n\n**InstanceFormatSpecField** This is a class that extends InstanceSpecField and can dynamically choose the image format (e.g. JPEG, PNG, GIF). PNGs have a much larger file size than JPEGs, but sometimes it's worth the filesize; this allows the admins to control on a per-image basis. Just pass a reference to the model field that returns a PIL-compatible file format.\n\n**ImageCropField** This is a custom model field for setting the image crop. This uses a custom\nwidget to allow admins to visually crop the image.\n\n**PositionCrop** This a custom processor which recieves the model instance and crops the image\nusing the image source and the value of the image crop field.\n\n**FormatProcessor** This is a custom processor which implements resizing and outputs to a dynamic format.\n\n**PositionAndFormatCrop** This processor extends PositionCrop and also implements dynamic format.\n\n**WARNING:** This library is in very early alpha stages. I have only tested this on version django-imagekit==3.2.5\n\n## Example Usage\n```\n $ pip install django-imagekit-cropper\n```\n\n```\n #settings.py\n\n INSTALLED_APPS = (\n ...\n imagekit_cropper,\n ...\n )\n``` \n\n\n```python\n #models.py\n\n from imagekit_cropper.fields import ImageCropField, InstanceSpecField, InstanceFormatSpecField\n from imagekit_cropper.processors import PositionCrop, PositionAndFormatCrop, FormatProcessor\n\n image = models.ImageField(blank=True, null=True)\n \n #Example 1 - BASIC CROP FIELD\n width_1200_wide_crop_properties = {\n 'source':'image',\n 'crop_field':'width_1200_wide_crop', \n 'resize_method':'fill',\n 'width':1200,\n 'height':750, \n 'upscale':True\n }\n width_1200_wide_crop = ImageCropField(null=True, blank=True, \n properties=width_1200_wide_crop_properties)\n\n width_1200_wide = InstanceSpecField( \n source=width_1200_wide_crop_properties['source'], \n options={'quality': 85}, \n processors=[PositionCrop(width_1200_wide_crop_properties)])\n\n #Example 2 - DYNAMIC FORMAT FIELD\n \n \n width_1200_crop_properties = {\n 'source':'image',\n 'format_field':'get_format',\n 'resize_method':'fit',\n 'width':1200,\n 'height':None, \n 'upscale':False\n }\n width_1200 = InstanceFormatSpecField( \n source=width_1200_crop_properties['source'], \n format_field=width_1200_crop_properties['format_field'],\n options={'quality': 95}, \n processors=[FormatProcessor(width_1200_crop_properties)])\n \n use_png = models.BooleanField( default = False, \n verbose_name='Use .PNG (instead of .JPG)')\n \n @property\n def get_format(self):\n if self.use_png:\n return 'PNG'\n return 'JPEG'\n\n\n #Example 3 - TWO SPECS USING THE SAME CROP\n\n square_crop_properties = {\n 'source':'image',\n 'crop_field':'square_crop', \n 'format_field':'get_format',\n 'resize_method':'fill',\n 'aspect_ratio':1,\n 'min_width':400,\n 'min_height':400,\n 'upscale':False\n }\n square_crop = ImageCropField(null=True, blank=True, properties=square_crop_properties)\n\n square_200_crop_properties = copy.copy(square_crop_properties)\n square_200_crop_properties['width'] = 200\n square_200_crop_properties['height'] = 200\n \n square_200 = InstanceSpecField(\n format='PNG',\n source=square_200_crop_properties['source'], \n options={'quality': 85}, \n processors=[PositionCrop(square_200_crop_properties)]\n )\n\n square_400_crop_properties = copy.copy(square_crop_properties)\n square_400_crop_properties['width'] = 400\n square_400_crop_properties['height'] = 400\n\n square_400 = InstanceFormatSpecField(\n source=square_400_crop_properties['source'], \n format_field=square_400_crop_properties['format_field'],\n options={'quality': 85}, \n processors=[PositionAndFormatCrop(square_400_crop_properties)]\n )\n\n``` \n\n```python\n #admin.py\n\n from .forms import ImageAdminForm\n \n class ImageAdmin(models.ModelAdmin):\n form = ImageAdminForm\n\n``` \n\n```python\n #forms.py\n\n from django import forms\n from imagekit_cropper.widgets import ImageCropWidget \n from .models import Image\n\n \n class ImageAdminForm(forms.ModelForm):\n square_150_crop = forms.CharField(widget=ImageCropWidget(properties=Image.square_150_crop_properties, help_text=Image.help['square_150_crop']))\n\n class Meta:\n model = Image\n\n``` \n\nTo generate images, you'll need to use this modified version of the generateimages command:\n```\n $ python manage.py generateimages_cropped\n```\n\n", "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/ninapavlich/django-imagekit-cropper", "keywords": "libraries,web development,cms,django,django-grappelli", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "django-imagekit-cropper", "package_url": "https://pypi.org/project/django-imagekit-cropper/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-imagekit-cropper/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/ninapavlich/django-imagekit-cropper" }, "release_url": "https://pypi.org/project/django-imagekit-cropper/1.16/", "requires_dist": null, "requires_python": null, "summary": "Allow users to manually specify image variant crops", "version": "1.16" }, "last_serial": 2491126, "releases": { "1.10": [ { "comment_text": "", "digests": { "md5": "1d6fa2b410280162542e9c5ef7ccf040", "sha256": "175f3a2d457344f57d7890a29911337d46532103c53c52a67ac9edd5150d1896" }, "downloads": -1, "filename": "django-imagekit-cropper-1.10.tar.gz", "has_sig": false, "md5_digest": "1d6fa2b410280162542e9c5ef7ccf040", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 151606, "upload_time": "2015-12-10T04:20:11", "url": "https://files.pythonhosted.org/packages/41/b5/28887bcbd93a7f075791340eb39b00138b108257984e45167726214b012a/django-imagekit-cropper-1.10.tar.gz" } ], "1.11": [ { "comment_text": "", "digests": { "md5": "262feea9141b3a46a1c28a62a43f16da", "sha256": "b6ae402b03e27c9a7184ccac1c55ec26d0819240e34958de78156b17cdf47062" }, "downloads": -1, "filename": "django-imagekit-cropper-1.11.tar.gz", "has_sig": false, "md5_digest": "262feea9141b3a46a1c28a62a43f16da", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 151630, "upload_time": "2016-03-13T18:35:15", "url": "https://files.pythonhosted.org/packages/e5/74/f43b147f699aa85cebd314ff46c89c691331a7f7aaad1ec69c870d6258fd/django-imagekit-cropper-1.11.tar.gz" } ], "1.12": [ { "comment_text": "", "digests": { "md5": "19b071a19cba6f35f1725ae7e50f00bf", "sha256": "2089ebb94bb9c0daf00833834f1913d2cf68bc42bf1077a59e40b5c063f0e6e6" }, "downloads": -1, "filename": "django-imagekit-cropper-1.12.tar.gz", "has_sig": false, "md5_digest": "19b071a19cba6f35f1725ae7e50f00bf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 151650, "upload_time": "2016-03-13T19:03:57", "url": "https://files.pythonhosted.org/packages/35/83/55a70638a33959b1ddc87f4c66adc263be6b77ef78f8c29a3e9c0eab51f2/django-imagekit-cropper-1.12.tar.gz" } ], "1.13": [ { "comment_text": "", "digests": { "md5": "214f2786840162a6fcc6b0d7ac5a0a23", "sha256": "c64682211bd0dc6daca6bb33a6ed5ce0130acf38569760b9420869282ff7a4c4" }, "downloads": -1, "filename": "django-imagekit-cropper-1.13.tar.gz", "has_sig": false, "md5_digest": "214f2786840162a6fcc6b0d7ac5a0a23", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 151685, "upload_time": "2016-03-13T19:17:59", "url": "https://files.pythonhosted.org/packages/c0/cb/cfd3097b75d6784c066a7c2bb1ad9dc6a89ff1f0d010a5e5e5b4edf1b06b/django-imagekit-cropper-1.13.tar.gz" } ], "1.14": [ { "comment_text": "", "digests": { "md5": "bda430dd392fc5d9dd5073a162734bfc", "sha256": "42044fb29f76841074b329c9ef19fb7d9da0f80452da1dcca19f116e4910d20e" }, "downloads": -1, "filename": "django-imagekit-cropper-1.14.tar.gz", "has_sig": false, "md5_digest": "bda430dd392fc5d9dd5073a162734bfc", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 151680, "upload_time": "2016-03-13T19:27:29", "url": "https://files.pythonhosted.org/packages/d8/8d/f08d6c8901abe3964252188b89daf463de9523ee4497e0592d8144f38120/django-imagekit-cropper-1.14.tar.gz" } ], "1.15": [ { "comment_text": "", "digests": { "md5": "e0db59fed521fb0cde8b9341ead06426", "sha256": "247ba0cfcb7c7f7ce667b4b8299b9d929d5db96be505d1a0f38aa8e71322d5d4" }, "downloads": -1, "filename": "django-imagekit-cropper-1.15.tar.gz", "has_sig": false, "md5_digest": "e0db59fed521fb0cde8b9341ead06426", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 151645, "upload_time": "2016-10-17T19:33:56", "url": "https://files.pythonhosted.org/packages/4d/e6/377449f0fa7e706a7ac7801beef7ef704345cefa87fad7fb1dfe66d89a71/django-imagekit-cropper-1.15.tar.gz" } ], "1.16": [ { "comment_text": "", "digests": { "md5": "5fce4ad022c6d9d3d74f21de6ef65772", "sha256": "bdfebabe59c95f90e60d72dc67923db1d02fe94d0af464f849155b7c4589ecde" }, "downloads": -1, "filename": "django-imagekit-cropper-1.16.tar.gz", "has_sig": false, "md5_digest": "5fce4ad022c6d9d3d74f21de6ef65772", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 151695, "upload_time": "2016-11-30T07:06:59", "url": "https://files.pythonhosted.org/packages/58/3f/ac88bd7329b311e2b1d2f2b4252532f1f3c637ed9f55b2215149677f76da/django-imagekit-cropper-1.16.tar.gz" } ], "1.8": [ { "comment_text": "", "digests": { "md5": "525c877316c6524c4e4b5f56c7e4cf52", "sha256": "0b5d5cc551e958643b28c06a425394269e55e3d335431ce206b4bcad105190fb" }, "downloads": -1, "filename": "django-imagekit-cropper-1.8.tar.gz", "has_sig": false, "md5_digest": "525c877316c6524c4e4b5f56c7e4cf52", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8517, "upload_time": "2015-09-11T23:06:23", "url": "https://files.pythonhosted.org/packages/61/69/9e090a0e871c140108ff6d2a50f2d42f304f32fa85af5332bf215f679e93/django-imagekit-cropper-1.8.tar.gz" } ], "1.9": [ { "comment_text": "", "digests": { "md5": "95d24f34c3f50d87ebdf3821be0129c9", "sha256": "207244bcf0ce4e4e902067c8946f70121eceb70536429cff2afec2c978222e36" }, "downloads": -1, "filename": "django-imagekit-cropper-1.9.tar.gz", "has_sig": false, "md5_digest": "95d24f34c3f50d87ebdf3821be0129c9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 151664, "upload_time": "2015-10-29T22:16:28", "url": "https://files.pythonhosted.org/packages/05/30/6ab304512da763681b7a8f8bd1ecc133ede72f30e31e651618f37e5c4418/django-imagekit-cropper-1.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5fce4ad022c6d9d3d74f21de6ef65772", "sha256": "bdfebabe59c95f90e60d72dc67923db1d02fe94d0af464f849155b7c4589ecde" }, "downloads": -1, "filename": "django-imagekit-cropper-1.16.tar.gz", "has_sig": false, "md5_digest": "5fce4ad022c6d9d3d74f21de6ef65772", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 151695, "upload_time": "2016-11-30T07:06:59", "url": "https://files.pythonhosted.org/packages/58/3f/ac88bd7329b311e2b1d2f2b4252532f1f3c637ed9f55b2215149677f76da/django-imagekit-cropper-1.16.tar.gz" } ] }