def _to_image(data, width):
    """Convert data to an image.

    Parameters
    ----------
    data : array_like
        Values of the pixels
    width : int
        Width of the image in pixels

    Returns
    -------
    ndarray
        Data reshaped into an ndarray with width `width`
    """
    return data.reshape(len(data) // width, width)