Image.fromarray results in a horizontal image

I have an array of 100 randomly generated values I’d like to encode into a 100px X 1px JPEG image. So I tried the following:

from PIL import Image
import numpy as np

# create an array of random values
def createArray(length):
    randArr = np.random.rand(10000)
    mapper = lambda t: scale(t, (0, 1), (0, 255))
    vfunc = np.vectorize(mapper)
    return vfunc(randArr)

# for scaling random values of 0-1 to 0, 255
def scale(val, src, dst):
    Scale the given value from the scale of src to the scale of dst.
    return ((val - src[0]) / (src[1] - src[0])) * (dst[1] - dst[0]) + dst[0]

def main():
    arr = createArray(100)
    im = Image.fromarray(np.asarray(arr))
    if im.mode != 'RGB':
        im = im.convert('RGB')"data.jpeg")


However this results in a 1px X 100px image:

How do I specify that I would like to encode the values in a single strip along the width of the image and not the height?


L'appel de Marseille rejeté après les incidents à Lyon thumbnail

L’appel de Marseille rejeté après les incidents à Lyon

Automatic Audio-to-symbolic Arrangement