1Interoperability 2================ 3 4.. _imageorder: 5 6Image processing software 7------------------------- 8Some python image processing software packages 9organize arrays differently than rasterio. The interpretation of a 103-dimension array read from ``rasterio`` is:: 11 12 (bands, rows, columns) 13 14while image processing software like ``scikit-image``, ``pillow`` and ``matplotlib`` are generally ordered:: 15 16 (rows, columns, bands) 17 18The number of rows defines the dataset's height, the columns are the dataset's width. 19 20Numpy provides a way to efficiently swap the axis order and you can use the 21following reshape functions to convert between raster and image axis order: 22 23.. code:: python 24 25 >>> import rasterio 26 >>> from rasterio.plot import reshape_as_raster, reshape_as_image 27 28 >>> raster = rasterio.open("tests/data/RGB.byte.tif").read() 29 >>> raster.shape 30 (3, 718, 791) 31 32 >>> image = reshape_as_image(raster) 33 >>> image.shape 34 (718, 791, 3) 35 36 >>> raster2 = reshape_as_raster(image) 37 >>> raster2.shape 38 (3, 718, 791) 39 40