I recently had to resize an awful lot of images for a client’s site in order to improve their load time. The site is very image heavy, but some of these images were over 6mb, which has serious ramifications for SEO and general user experience, especially on mobile.
In today’s post, I’m going to take you through the solution I came up with, using R to resize the images to your chosen dimensions. There weren’t really any full guides to doing this that I could find on Google, so hopefully this is helpful.
This R function will let you do the following, all in one go:
- Bulk download a series of images
- Load them into your R environment
- Resize them to your specified dimensions
- Save the resized images
It’s basically the all-in-one image resizing function for R. Handy, right?
Preparing Your Data
You’ll need to do a little bit of prep on your data in order to get this running. The easiest way to do that is to put the following in a CSV file and read them into your R environment....
Comics are awesome. If you know me, you’ll know they’re one of my favourite things; Marvel, DC, Image, self-published, it doesn’t matter. If it’s good, I’ll read it, although thanks to the excellent Marvel Unlimited service, most of what I read comes from them. Marvel Unlimited, my shiny Android tablet and my trusty iPod Classic get me through even the most challenging of commutes.
Having binged an awful lot of their crossover events over the last couple of years, I recently got to wondering which character had been in the most of them and, thanks to the brilliant Marvel API, R and a little patience, I’ve managed to find not just this answer, but a couple of other interesting ones too.
I had so much fun doing this that there may well be a few follow-up posts using the API, but today, I’m going to stick to the question that spurred this post: Which Marvel character has been in the most crossover events?
Unless you’ve been living under a rock recently, you’ll have heard the news about the Yahoo data breach. If you haven’t, the basics are that Yahoo User details were compromised a few years back, and anyone that had an email account with them up until that point may have had their email addresses and passwor...
Although the way they phrase it in their blog post frames this change as benevolent, allowing them to a...
A big part of my job for the last few months has been updating my agency’s data protection policies and practices in order to get us in line with the forthcoming EU data protection law, known as the GDPR (General Data Protection Ruling). It’s been a lot of fun, and it’s not quite over, but some people have as...