![]() I tried out the program with the following image which is called canterbury.jpg, and hard-coded the filename. After the loops we just need to return the new image. Finally we set the relevant pixel to the RGB value. Remember these are decimals from 0 to 1 so then need to be multiplied by 255 and cast to ints. Within nested loops for the rows and columns we call colorsys.hls_to_rgb (again note the HLS rather than HSL) to get a tuple of RGB values. image_from_hls_arrayįirstly we create a new Pillow image the same size as the numpy array, after which we effectively reverse the process carried out by create_hls_array. After the loop exits we just return the array. We then set the three third-dimension values to the hue, lightness and saturation values respectively.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |