def load_image() -> Cimpl.Image: """ Author: Ibrahim Kasim, Himanshu Singh RETURNS a Cimpl.Image object. Prompts the user to select an image file to load, and displays the loaded image >>> load_image() """ print("Select an image file to load") image = Cimpl.load_image(Cimpl.choose_file()) Cimpl.show(image) return image
def green_channel(): """ The Author: Ibrahim Kasim green_channel() -> Cimpl.Image: Returns green filtered image. It directs user to choose an image that is desired for filtering. """ image_file = Cimpl.choose_file() original_image = Cimpl.load_image(image_file) new_image = Cimpl.copy(original_image) for pixel in original_image: x, y, (r, g, b) = pixel green_color = Cimpl.create_color(0, g, 0) Cimpl.set_color(new_image, x, y, green_color) return new_image
else: xOffset = int(xOffset) if yOffset == '': yOffset = 0 else: yOffset = int(yOffset) itemCoords = extract_coords(customSelection) updatedStateList = place_item(updatedStateList, itemCoords, xOffset, yOffset) elif itemSelection == '3': print("\nLOAD DATA:") print("\nChoosing file...") filename = Cimpl.choose_file() itemData = open(filename, 'r') print("Data loaded successfully from path:") print(filename) print("\nPOSITION:") xOffset = input("\nPROMPT (x offset): ") yOffset = input("PROMPT (y offset): ") if xOffset == '': xOffset = 0 else: xOffset = int(xOffset) if yOffset == '': yOffset = 0
#Convert the altered pixel green component in binary from a list to a string new_green = ''.join(str(e) for e in pixel_green_binary) new_green = int(new_green, 2) #Convert the altered pixel blue component in binary from a list to a string new_blue = ''.join(str(e) for e in pixel_blue_binary) new_blue = int(new_blue, 2) #Create and Set color new_color = Cimpl.create_color(new_red, new_green, new_blue) Cimpl.set_color(img, x, y, new_color) #load image image = Cimpl.load_image(Cimpl.choose_file()) #Convert user input string to binary string = input("Input the text you would like to hide:") string = "*****" + string + '|||||' string_in_bin = text_to_bits(string) string_in_bin = list(string_in_bin) #calculate how many bits we can alter image_width = Cimpl.get_width(image) image_height = Cimpl.get_height(image) open_bits = image_width*image_height*3