{"id":10046,"library":"pixeloe","title":"PixelOE (Detail-Oriented Pixelization)","description":"PixelOE is a Python library for detail-oriented image pixelization based on a contrast-aware outline expansion algorithm. It's designed to create pixel art-style images while preserving key details. The current version is 0.1.4, and the library appears to be actively maintained with releases as features and improvements are developed.","status":"active","version":"0.1.4","language":"en","source_language":"en","source_url":"https://github.com/KohakuBlueleaf/PixelOE","tags":["image-processing","pixel-art","computer-vision","image-manipulation","graphics"],"install":[{"cmd":"pip install pixeloe","lang":"bash","label":"Install stable release"}],"dependencies":[{"reason":"Core numerical operations for image processing.","package":"numpy"},{"reason":"Computer vision functionalities.","package":"opencv-python"},{"reason":"Image processing algorithms.","package":"scikit-image"},{"reason":"Scientific computing, potentially for image filtering or transformations.","package":"scipy"},{"reason":"Image loading, saving, and basic manipulation.","package":"Pillow"},{"reason":"Progress bar for long-running operations.","package":"tqdm"}],"imports":[{"note":"While 'from pixeloe import pixelize' works, the official examples generally use 'import pixeloe' and then call 'pixeloe.pixelize' for clarity, indicating `pixelize` is the primary function within the pixeloe module.","wrong":"from pixeloe import pixelize","symbol":"pixelize","correct":"import pixeloe\noutput_image = pixeloe.pixelize(...)"}],"quickstart":{"code":"from PIL import Image\nimport pixeloe\nimport os\n\n# Create a dummy image for demonstration\nimg_path = \"example_input.png\"\nImage.new('RGB', (100, 100), color = 'red').save(img_path)\n\n# Load the image\nimg = Image.open(img_path).convert(\"RGB\")\n\n# Pixelize the image with specified parameters\n# pixels: size of pixelization blocks\n# contrast: contrast awareness level\n# outline: whether to include outlines\n# levels: number of color levels to quantize to\nout_img = pixeloe.pixelize(img, pixels=8, contrast=250, outline=True, levels=8)\n\n# Save the output image\noutput_path = \"pixelized_output.png\"\nout_img.save(output_path)\nprint(f\"Original image saved to {img_path}\")\nprint(f\"Pixelized image saved to {output_path}\")\n\n# Clean up dummy image\nos.remove(img_path)","lang":"python","description":"This quickstart loads an image (a dummy one created for the example), applies the `pixelize` function with common parameters, and saves the resulting pixelized image. The `pixelize` function takes a `PIL.Image` object as input and returns a new `PIL.Image` object."},"warnings":[{"fix":"Ensure your Python environment is 3.10 or higher. Use `python --version` to check.","message":"PixelOE requires Python 3.10 or newer. Installing on older Python versions will fail or result in dependency issues.","severity":"gotcha","affected_versions":"<0.1.0"},{"fix":"Convert your image to a PIL Image first. E.g., for an OpenCV (NumPy) image: `pil_img = Image.fromarray(cv2.cvtColor(np_img, cv2.COLOR_BGR2RGB))`.","message":"The `pixelize` function exclusively expects a `PIL.Image` object as input. Passing NumPy arrays (common for OpenCV) or other image formats will lead to `AttributeError` or `TypeError`.","severity":"gotcha","affected_versions":"All"},{"fix":"For performance-critical applications, pre-process large images by resizing them to a smaller resolution using `PIL.Image.resize()` before passing them to `pixeloe.pixelize()`.","message":"Processing very large images (e.g., several megapixels) can be slow and consume significant memory due to the detailed analysis performed by the algorithm. Consider downscaling images if performance is critical.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-17T00:00:00.000Z","next_check":"2026-07-16T00:00:00.000Z","problems":[{"fix":"Install the library using pip: `pip install pixeloe`","cause":"The pixeloe library has not been installed or is not accessible in the current Python environment.","error":"ModuleNotFoundError: No module named 'pixeloe'"},{"fix":"Convert your NumPy array to a PIL Image. Example: `from PIL import Image; pil_img = Image.fromarray(cv2.cvtColor(numpy_img, cv2.COLOR_BGR2RGB))`","cause":"You are attempting to pass a NumPy array (e.g., from OpenCV) directly to `pixeloe.pixelize`, but it expects a `PIL.Image` object.","error":"AttributeError: 'numpy.ndarray' object has no attribute 'convert'"},{"fix":"Save the PIL Image directly using its `save()` method: `output_pil_image.save('output.png')` or convert it to a NumPy array first if you need to use OpenCV functions: `numpy_array = np.array(pil_image)`.","cause":"You're trying to save a `PIL.Image` object returned by `pixeloe.pixelize` using a method that expects a NumPy array (e.g., `cv2.imwrite`).","error":"AttributeError: 'Image' object has no attribute 'to_numpy'"}]}