pdp.dev

Amazon Spheres

I got to tour the Spheres at Amazon this week, and it was pretty awesome. There’s quite a lot of space to hang out and relax, but for now you have to make an appointment to go as they ramp up letting people in. I sat for a bit and enjoyed a donut.

I took these pictures on my iPhone 8 Plus, and pretty much just walked around and snapped whatever.

To put these on this page, I wanted to resize them such that the width of the images was fixed regardless of their orientation. To do this, I used ImageMagick. These notes are mostly for me.

First, I need to find each image’s orientation:

for i in `ls *.jpeg`; do 
   j=`identify -format '%[orientation]' $i`; 
   echo $j,$i;
done

This gives output like this:

BottomRight,2018-02-06_09-30-16_283.jpeg
RightTop,2018-02-06_09-30-25_981.jpeg
  • BottomRight = landscape, or wider than tall.
  • RightTop = portrait, or taller than wide.

To resize the portrait images (and also rename them from .jpeg to .jpg):

for i in `grep RightTop files.out | cut -d, -f2`; do 
    echo $i; 
    convert $i -resize "1024x" -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG -colorspace sRGB -auto-orient ${i: : -5}.jpg; 
done

To resize the landscape images:

for i in `grep BottomRight files.out | cut -d, -f2`; do
    echo $i; 
    convert $i -resize "768x" -sampling-factor 4:2:0 -strip -quality 85 -interlace JPEG -colorspace sRGB -auto-orient ${i: : -5}.jpg;
done

Neat!