Ben Gorman

Ben Gorman

Life's a garden. Dig it.

You're a pixel artist 👩‍🎨. You have a collection of five 10x10-pixel images stored in a 5x3x10x10 array.

import numpy as np
rng = np.random.default_rng(1234)
imgs = rng.uniform(low=0, high=1, size=(5,3,10,10))

The (i,j,k,l) element corresponds to the ith image, jth color channel (RGB), kth row of pixels, jth column of pixels.

You want to plot these images, but your plotting software expects color channel to be the last dimension of the array. Rearrange your array accordingly.


This content is gated

Subscribe to one of the products below to gain access