euro_flag_demo

# Image files¶

In [1]:

    import numpy as np
    import pynsn as nsn
    from pynsn.image import pil_image

    euro_array = nsn.RectangleArray(target_area_radius=200, min_dist_between=1)
    # adding eurostar pictures 12 times
    for x in np.linspace(start=0, stop=2*np.pi, num=12+1):
        if x < 2*np.pi:
            pos = np.sin(x)*140, np.cos(x)*140
            pict = nsn.Rectangle(xy=pos, size=(40, 40),
                                 attribute=nsn.PictureFile("eurostar.png"))
            euro_array.add(pict)

    # showing
    euro_col = nsn.ImageColours(target_area="#003399", background="#003399")
    pil_image.create(euro_array, euro_col)

    PyNSN 0.13.0

Out[1]:
In [2]:

    euro_array.mod_shuffle_positions()
    pil_image.create(euro_array, euro_col)

Out[2]:
In [3]:

    factory = nsn.NSNFactory(target_area_radius=200,
                             min_dist_between=1)
    factory.set_appearance_rectangle(width=(10, 20, 30, 40),
                                     proportion=1,
                                     attributes=nsn.PictureFile("eurostar.png"))
    euro_array = factory.create_random_array(n_objects=12)
    pil_image.create(euro_array, euro_col)

Out[3]:
In [ ]: