ddwrt

After a few weeks with OpenWRT, I decided to switch over to DDWRT. There is nothing wrong with OpenWRT. DDWRT is a much simpler interface. It seems to be very stable as well. I don’t recall any reboots other than service provider having an internet issue. I think that was a great decision while still using old router hardware, a Linksys E4200 circa 2011 (release date). One of these days I will have to purchase a new router, but why fix something that not broken.

February 22, 2024 · 1 min · ulysses

brigthen

A little Python script to brighten an image. import os from PIL import ImageEnhance, Image def brightenImage(input_dir, output_dir): os.makedirs(output_dir, exist_ok=True) # output directory for filename in os.listdir(input_dir): # loop through files if filename.lower().endswith('.jpg'): # check if jpg with Image.open(os.path.join(input_dir, filename)) as img: # open jpg enhanced_img = ImageEnhance.Contrast(img).enhance(1.25) # enhance contrast enhanced_img = ImageEnhance.Brightness(enhanced_img).enhance(1.5) # enhance brightness enhanced_img.save(os.path.join(output_dir, filename)) # save output if __name__ == '__main__': input_directory = '.' # input directory output_directory = 'output' # output directory brightenImage(input_directory, output_directory) # brighten image

February 19, 2024 · 1 min · ulysses

enhance

Here’s a litte Python script that enhance a jpg image. import os from PIL import ImageEnhance, Image def enhance(input_dir, output_dir, factor=1.75): os.makedirs(output_dir, exist_ok=True) # Create output directory for filename in os.listdir(input_dir): # Loop through all files if filename.lower().endswith('.jpg'): # Check if JPG image with Image.open(os.path.join(input_dir, filename)) as img: # Open the image file enhanced_img = ImageEnhance.Color(img).enhance(factor) # Enhance image enhanced_img.save(os.path.join(output_dir, filename)) # Save image if __name__ == '__main__': input_directory = '.' # input directory output_directory = 'output' # output directory enhance(input_directory, output_directory) # enhance

February 19, 2024 · 1 min · ulysses

resize

Here’s a little Python script that creates thumbnails. import os from PIL import Image def resize(input_dir, output_dir, thumbnail_size=(720, 720)): # set to 720p os.makedirs(output_dir, exist_ok=True) # output directory for filename in os.listdir(input_dir): # loop through files if filename.lower().endswith('.jpg'): # check if JPG with Image.open(os.path.join(input_dir, filename)) as img: # open image img.thumbnail(thumbnail_size) # reduce to thumbnail img.save(os.path.join(output_dir, filename)) # save thumbnail if __name__ == '__main__': input_directory = '.' # input directory output_directory = 'output' # output directory resize(input_directory, output_directory) # resize images

February 19, 2024 · 1 min · ulysses

vintage

Here’s a little Python script that makes vintage pictures. import os from PIL import Image, ImageFilter, ImageOps, ImageEnhance def vintage(input_dir, output_dir): os.makedirs(output_dir, exist_ok=True) # output directory for filename in os.listdir(input_dir): # Loop through files if filename.lower().endswith('.jpg'): # Check if JPG with Image.open(os.path.join(input_dir, filename)) as img: # Open jpg img = img.convert("RGB") # vintage effects img = ImageOps.grayscale(img) img = img.filter(ImageFilter.SMOOTH_MORE) img = ImageOps.posterize(img, 8) img = ImageEnhance.Contrast(img).enhance(1.4) img = ImageEnhance.Brightness(img).enhance(1.75) img = ImageOps.colorize(img, "#704214", "#eeeeee") img = ImageEnhance.Color(img).enhance(0.8) img.save(os.path.join(output_dir, filename)) # Save image if __name__ == '__main__': input_directory = '.' # input directory output_directory = 'output' # output directory vintage(input_directory, output_directory) # make vintage

February 19, 2024 · 1 min · ulysses

white balance

Here’s a little Python script that corrects white balance. import os from PIL import Image def whiteBalance(input_dir, output_dir, red_ratio=1.0, blue_ratio=1.0): os.makedirs(output_dir, exist_ok=True) # output directory for filename in os.listdir(input_dir): # Loop through files if filename.lower().endswith(('.jpg', '.jpeg', '.png')): # Check if image with Image.open(os.path.join(input_dir, filename)) as img: # Open the image red_channel = img.getchannel('R') # wb correction green_channel = img.getchannel('G') blue_channel = img.getchannel('B') red_channel = red_channel.point(lambda p: min(int(p * red_ratio), 255)) # Adjust colors blue_channel = blue_channel.point(lambda p: min(int(p * blue_ratio), 255)) corrected_img = Image.merge('RGB', (red_channel, green_channel, blue_channel)) # merge colors corrected_img.save(os.path.join(output_dir, filename)) # Save image if __name__ == '__main__': input_directory = '.' # input directory output_directory = 'output' # output directory red_ratio = 0.9 # Adjust red blue_ratio = 1.5 # Adjust blue whiteBalance(input_directory, output_directory, red_ratio, blue_ratio) # Correct wb

February 19, 2024 · 1 min · ulysses

black and white

Here’s a Python code to convert JPG pictures to black and white. import os from PIL import Image # black and white def blackWhite(input_dir, output_dir): os.makedirs(output_dir, exist_ok=True) # output directory for filename in os.listdir(input_dir): # loop all files if filename.lower().endswith('.jpg'): # Check if JPG image with Image.open(os.path.join(input_dir, filename)) as img: # Open image file bw_img = img.convert('L') # Convert to bw bw_img.save(os.path.join(output_dir, filename)) # Save bw if __name__ == '__main__': input_directory = '.' # input directory output_directory = 'output' # output directory blackWhite(input_directory, output_directory) # conver to bw

February 13, 2024 · 1 min · ulysses

nef to jpg

If you have a Nikon DSLR camera and you shoot in RAW format, you’ll end up with a NEF file. You can easily convert several NEF files to JPG by running a Python script. It’s fast and works fairly well. If you want to run in a controlled Python environment, I suggest that you create a virtual environment. You can group all your imaging scripts in one virtual environment. Here’s the code to convert NEF files to JPG. ...

February 12, 2024 · 1 min · ulysses

oh-my-posh

If you are tired of using the default Terminal prompt, then give oh-my-posh a try. Whether you’re using bash in Linux or zsh on a Mac, oh-my-posh can style your prompt. Get familiar with oh-my-posh’s syntax. It’s not difficult once you get rolling. Browse several of the themes available on their site to get ideas. Head over to Canva.com to get a color palette. Here’s my current prompt setup.

February 11, 2024 · 1 min · ulysses

jump start power supply

A week ago, I was messing around with my motherboard trying to fix my RGB lights so that the RGB lights can all be controlled from one controller. I accidentally short-circuited something on the motherboard. The computer kept running to my suprise, but immediately after powering down the system, the computer would no longer power up. I thought I had fried my power supply. Worse, I may have fried the motherboard. ...

February 6, 2024 · 2 min · ulysses