{"id":6771,"library":"pilkit","title":"PILKit","description":"PILKit is a collection of utilities and processors built on top of the Python Imaging Library (PIL), primarily Pillow. It simplifies common image manipulation tasks by providing an easy-to-use API for operations like resizing, adjusting, and cropping. The current stable version is 3.0, released in September 2023, and the library maintains an active development cadence.","status":"active","version":"3.0","language":"en","source_language":"en","source_url":"https://github.com/matthewwithanm/pilkit/","tags":["image processing","Pillow","PIL","image manipulation"],"install":[{"cmd":"pip install pilkit","lang":"bash","label":"Install PILKit"},{"cmd":"pip install Pillow","lang":"bash","label":"Install Pillow (Required Dependency)"}],"dependencies":[{"reason":"PILKit builds on Pillow (a fork of PIL) for all image processing functionality. Pillow must be installed separately.","package":"Pillow","optional":false}],"imports":[{"symbol":"ResizeToFit","correct":"from pilkit.processors import ResizeToFit"},{"symbol":"ProcessorPipeline","correct":"from pilkit.processors import ProcessorPipeline"},{"note":"Image preparation utilities are in `pilkit.utils`, not `pilkit.processors`.","wrong":"from pilkit.processors import prepare_image","symbol":"prepare_image","correct":"from pilkit.utils import prepare_image"},{"note":"The `pilkit.utils.save_image` utility handles common PIL saving errors, such as 'Suspension not allowed here'.","wrong":"from PIL.Image import save","symbol":"save_image","correct":"from pilkit.utils import save_image"}],"quickstart":{"code":"import os\nfrom PIL import Image\nfrom pilkit.processors import ResizeToFit\nfrom pilkit.utils import save_image\n\n# Create a dummy image for demonstration\ntry:\n    img = Image.new('RGB', (200, 150), color = 'red')\n    img.save('original_image.png')\nexcept ImportError:\n    print(\"Pillow not installed. Please install it with 'pip install Pillow'.\")\n    exit()\n\n# Define a processor\nprocessor = ResizeToFit(width=100, height=100, upscale=False)\n\n# Process the image\noriginal_image = Image.open('original_image.png')\nprocessed_image = processor.process(original_image)\n\n# Save the processed image using pilkit's utility\nsave_image(processed_image, 'processed_image.png', 'PNG')\n\nprint(\"Original image saved as original_image.png\")\nprint(\"Processed image (resized to fit 100x100) saved as processed_image.png\")\n\n# Clean up (optional)\nos.remove('original_image.png')\nos.remove('processed_image.png')","lang":"python","description":"This quickstart demonstrates how to use a PILKit processor (ResizeToFit) to modify an image. It also shows the recommended way to save the processed image using `pilkit.utils.save_image` to handle potential PIL errors. Ensure Pillow is installed before running."},"warnings":[{"fix":"Review the GitHub repository's commit history and source code changes when migrating between major versions.","message":"There is no explicit changelog or migration guide available between major versions, specifically from 2.x to 3.x. Users upgrading major versions may need to inspect the codebase for changes.","severity":"breaking","affected_versions":"2.x to 3.x"},{"fix":"Always ensure Pillow is installed in your environment alongside PILKit: `pip install Pillow`.","message":"PILKit relies on Pillow (or the deprecated PIL) for its core image handling. Pillow is a peer dependency and must be installed separately (e.g., `pip install Pillow`) for PILKit to function correctly.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Prefer `from pilkit.utils import save_image` and use it to save your images, instead of `PIL.Image.save()` directly.","message":"When saving processed images, direct use of `PIL.Image.save()` can sometimes lead to 'Suspension not allowed here' errors with certain image formats or operations. PILKit provides `pilkit.utils.save_image` to gracefully handle these common issues.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[]}