Skip to main content

Posts

Adventures in Pillow Part 2

From my last post  where I made a slideshow promo video, I realised how powerful Pillow is. I still have a fair bit of automation to do, so another thing I do a lot of is motivational quotes for Twitter (I am aware they are fucking stupid, but they share well) The breakdown of the components are a background with a filter, the quote, who said it and our logo. Background and Filter To start off I am going to create a folder called quote and add in an image and just name it background.jpg (sourced from Pixabay ). Next I import PIL and open the file. from PIL import Image import os , errno cwd = os.getcwd() image_dir = os.path.join(cwd , 'quote' ) def filterImage (imageFile): im = Image.open(imageFile) im.show() filterImage(os.path.join(image_dir , 'background.jpg' )) Next I need to crop the image. I am going to take the centre portion out of the image to make square. Like so: So I start off with getting the dimensions of the ima
Recent posts

Adventures with Pillow Part 1

I am in the middle of building an app and need to put together several promo videos for Twitter and Instagram, and man it is boring. So I thought 'how can I automate this process?', so welcome to this post. What I am going for is a selection of images, greyscaled flipping through with our logo on the front. So my approach was to use python, pillow and ffmpeg to build something. This could be disastrous. Images To start a few pre-flight checks, a variable for the test image and to check for/create a processed folder for the final images to go. import os , errno from PIL import Image , ImageFont , ImageDraw testImage = 'test.png' cwd = os.getcwd() image_dir = os.path.join(cwd , 'images' ) default_dir = os.path.join(cwd , 'processed' ) try : os.makedirs(default_dir) except OSError as e: if e.errno != errno.EEXIST: raise I am going to build a function that will do all of the processing, but first going to run on one image b

Cheapo Time Lapse

Photography on a Budget Who doesn't love a good time lapse, everything goes all fast like. Clouds zipping through the sky, cars turning into streaks across the image. So I wanted try my hand at making some, but I'm broke as a joke. Therefore I wondered with a bit of code and an old Android phone could I create one? Let have a go! Shitty Hardware I had in a box a old Android phone, an HTC Desire S S510e to be exact. It sports: Screen size: 3.7" Screen Resolution (pixels): 480 x 800 Operating system: Android 2.1 Camera resolution: 5MP camera Stand-by time: 17.9 Days Depth: 1.19cm deep Height: 11.9cm high Width: 6cm wide Autofocus: Yes Weight (g):130g FM tuner: FM Radio Release date: 5 Apr 2011 So a badly smashed screen, but not important. I ended up getting this phone just by asking a friend what they got hanging around in a drawer.  Camera Application Now the normal camera is not going to do. So I am gonna use IP Webcam , bas

Raspberry Pi Download Machine Part 3

Sometimes I Leave the House I go to work, to friends and sometimes just wonder around London. So what happens when a new post r/opendirectories appears, and I gotta grab me the new Marvel bullshit so I can take the piss out of it? For this to work we need external access. Port Forwarding Before I head into the world of port forwarding I'd just like to say that I am not a fan at all. Anything open is a way into you system and network, that being said here is how you do it. All of your devices are on a Local Area Network, that then goes out onto the internet to get stuff like dank memes and bring them back. Your router does the job of looking at who requested something and therefore whom to deliver to. Also your LAN appears on the internet as a single external IP address. So this leads to 2 questions: If sending to an external IP how does it know what internally it needs to send to? It doesn't But what about sending information in without a prior request? We

Raspberry Pi Download Machine Part 2

Well SSH is Boring I have got my RPi download machine up and running and having success, unfortunately though SSH is annoying and tedious, so I am gonna do something about it. But a disclaimer; this is my first time working with Aria2 in the most part. RPC  Remote Procedure Call is fancy way of saying 'make this thing make that thing do a thing'. So I ran the command to load the config file (and added to my init file) in the last post and ..... BOLLOCKS ALL. So ran the command again, and need to check the processes (like Task Manager). pi@raspberrypi : ~ $  ps aux | grep aria2c root       524  0.0  0.9  17028  9284 ?        Ss   21:21   0:00 aria2c --conf-path=/home/pi/.aria2/aria2.conf pi        1008  0.0  0.2   4272  1948 pts/0    S+   21:34   0:00 grep --color=auto aria2c There it is, that little scumbag. But still no dice. In the conf file I stated that the rpc-port to be 6800 so need to check that port.  A quick note on ports, every service