While few people loves ads, most people don’t mind them and understand that it’s one way to keep the internet open and accessible to as many people as possible. It’s hard to argue against ads that loads fast and don’t interrupt your browsing experience (and respects your privacy).
There are a couple of ways to finance content you publish online, popular choices include display ads and pay walls. As a user I usually prefer ads over paywalls, as long as the ads are not disturbing my overall experience.
This is just a short note to link to another blog article about why and a bit of how you can make display ads faster on your website that I wrote together with my colleagues.
I am currently in the process of (perhaps) buying a new camera. Currently I have a Sony A6000 with one standard zoom lens that has a focal length that goes from 18-50mm (or 24-75mm if you translate to 35mm sensors).
The cameras I’m looking at currently are full-format cameras, and the lenses for those cameras can get quite expensive – so I’m wondering if I can get away in the beginning just buying a fixed lens for the camera (cheaper).
The structured approach would of course be to analyze my photos taken with the zoom lens and see which focal length I use the most – since I want to get better at Python I decided that writing a Python script for this was the way forward. The script turned out to be quite short – the only dependency I didn’t already have installed was pillow.
The programming part
First we need to see if we can get the focal length easily, searching the spec for suitable EXIF information I found that 41989 is the key with the descriptive name “FocalLengthIn35mmFilm” – let’s try that!
It seems to work for most of my images, lets loop through all images in the folder and try it out
import PIL.Image
import matplotlib.pyplot as plt
import glob, os
for file in glob.glob("./**/*.JPG"):
FocalLengthIn35mmFilm = 41989
img = PIL.Image.open("image.JPG")
exif_data = img._getexif()
print exif_data[FocalLengthIn35mmFilm]
This appears to be working for most of my pictures – some images doesn’t contain any FocalLengthIn35mmFilm parameter so I’m skipping those images for now with a try/except and logging to stdout.
Instead of printing the sizes I need to add it to an array to visualize it with a histogram – check below for finished script.
Finished script
import glob, os
import PIL.Image
import matplotlib.pyplot as plt
focal_length_35 = []
FocalLengthIn35mmFilm = 41989
# Go through all JPG-files in all folders
for file in glob.glob("./**/*.JPG"):
img = PIL.Image.open(file)
exif_data = img._getexif()
try:
focal_length_35.append(int(exif_data[FocalLengthIn35mmFilm]))
except:
print "ERROR in file %s" % (file)
# Show histogram
plt.hist(focal_length_35)
plt.show()
Running the script above in a folder with some pictures gave me the following histogram
It seems that I’m a clear fan of focal length 24mm (at least for the folder I ran this on), something to think about at least. Now I probably need to go through all photos and separate the ones I like the most so I know which focal length I’m most happy with (the above script only gives me quantity, not the quality).
The blog has just moved to a brand new server since the old one had to be “sent to the farm”, stay tuned for updates 🙂
Since the old blog had so many no-so-interesting and / or outdated blog posts containing a mixed variety of Swedish and English I decided to clear the blog and give it a new consistent lifestyle.