{"id":7132,"library":"dask-image","title":"Dask-Image","description":"Dask-Image provides distributed image processing capabilities built on Dask, enabling scalable operations on large image datasets that exceed memory. It is currently at version 2025.11.0 and typically releases on an annual cadence, often in sync with other Dask ecosystem projects, with bug fix releases as needed.","status":"active","version":"2025.11.0","language":"en","source_language":"en","source_url":"https://github.com/dask/dask-image","tags":["dask","image-processing","distributed-computing","scientific-computing","big-data"],"install":[{"cmd":"pip install dask-image","lang":"bash","label":"Install Dask-Image basic"},{"cmd":"pip install 'dask-image[complete]'","lang":"bash","label":"Install Dask-Image with all optional dependencies (e.g., scikit-image, tifffile)"}],"dependencies":[{"reason":"Core dependency for distributed computing.","package":"dask","optional":false},{"reason":"Underlying array operations.","package":"numpy","optional":false},{"reason":"Commonly used for many image processing functions (e.g., filters, morphology) leveraged by dask-image.","package":"scikit-image","optional":true},{"reason":"Used by `dask_image.imread` for reading TIFF files.","package":"tifffile","optional":true}],"imports":[{"note":"The image loading utility was moved from dask.array to dask_image.imread in older versions.","wrong":"from dask.array.image import imread","symbol":"imread","correct":"from dask_image.imread import imread"},{"symbol":"gaussian_filter","correct":"from dask_image.ndfilters import gaussian_filter"},{"symbol":"label","correct":"from dask_image.ndmeasure import label"}],"quickstart":{"code":"import dask.array as da\nimport dask_image.imread\nimport numpy as np\n\n# Simulate loading a large image (e.g., a multi-gigabyte TIFF file)\n# In a real scenario, you'd use: image_dask = dask_image.imread.imread('path/to/your/large_image.tif')\n# For quickstart, create a dummy Dask array:\ndummy_data = np.random.rand(2000, 2000, 3).astype(np.float32)\nimage_dask = da.from_array(dummy_data, chunks=(512, 512, 3))\n\nprint(f\"Dask Array shape: {image_dask.shape}\")\nprint(f\"Dask Array chunks: {image_dask.chunks}\")\n\n# Perform a simple Dask computation (e.g., calculate the mean intensity)\nmean_intensity = image_dask.mean().compute()\nprint(f\"Mean intensity of the image: {mean_intensity:.4f}\")\n\n# Example using a filter (requires 'dask-image[complete]' for scikit-image)\n# from dask_image.ndfilters import gaussian_filter\n# filtered_image_dask = gaussian_filter(image_dask, sigma=1)\n# print(f\"Filtered Dask Array shape: {filtered_image_dask.shape}\")\n# print(f\"Filtered image mean: {filtered_image_dask.mean().compute():.4f}\")","lang":"python","description":"This quickstart demonstrates how to create a Dask Array from a dummy NumPy array (simulating a large image) and perform a basic Dask computation (calculating the mean intensity). For actual image files, `dask_image.imread.imread` is used. Note that many `dask-image` functions leverage underlying libraries like scikit-image, which might need to be installed separately for full functionality (e.g., `pip install 'dask-image[complete]'`)."},"warnings":[{"fix":"Always use `dask_image.ndfilters`, `dask_image.ndmeasure`, etc., or `dask.array` methods where available. For example, use `dask_image.ndfilters.gaussian_filter` instead of `scipy.ndimage.gaussian_filter` on a Dask array.","message":"Directly using NumPy or SciPy functions on Dask Arrays without Dask-Image wrappers will often fail or lead to inefficient computations.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Carefully consider your Dask array chunk sizes. For 3D+ data, matching chunks to processor cache or natural image tile boundaries is often optimal. Use `image_dask.rechunk()` to adjust if necessary. Monitor the Dask dashboard for memory usage.","message":"Poor chunking strategies can lead to severe performance issues or out-of-memory errors, especially when processing large images.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Update your import statement from `from dask.array.image import imread` to `from dask_image.imread import imread`. This is an older change but can still affect users following outdated tutorials.","message":"The `imread` function for image loading was moved from `dask.array.image` to `dask_image.imread`.","severity":"deprecated","affected_versions":"< 0.3.0 (dask-image) / Dask versions prior to 2021.06.0"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Change the import to `from dask_image.imread import imread`.","cause":"Attempting to import `imread` from the old `dask.array.image` path, which no longer exists.","error":"AttributeError: module 'dask.array' has no attribute 'image'"},{"fix":"Use the equivalent function from `dask_image.ndfilters` (e.g., `from dask_image.ndfilters import gaussian_filter`) or a `dask.array` method if one exists.","cause":"Trying to apply a raw SciPy (or NumPy) function directly to a Dask Array, which does not automatically distribute the operation.","error":"NotImplementedError: The 'scipy.ndimage.gaussian_filter' function is not implemented for Dask arrays."},{"fix":"Install `tifffile` via `pip install tifffile` or install `dask-image` with complete extras: `pip install 'dask-image[complete]'`.","cause":"Attempting to load TIFF files using `dask_image.imread.imread` without the necessary `tifffile` dependency installed.","error":"ModuleNotFoundError: No module named 'tifffile'"}]}