Download high definition images from christies

Alec Jacobson

July 14, 2012

weblog/

Place this in christies.sh:
#!/bin/bash

#id=D5391252
id=`echo "$1" | sed -e "s/.*ObjectID=\([0-9]*\)&.*/d\1/g"`
final=`echo "$1" | sed -e "s/.*lotfinder\\/[^\\/]*\\/\(.*\)-[0-9]*-details.*/\1/g"`
echo $id
echo $final


URL=http://www.christies.com/lotfinderimages/${id:0:6}/$id/TileGroup0/
echo $URL

# Explicitly declare integers
typeset -i i j k max_i max_j max_k tile_x tile_y

if [ $2 ]; then
  let max_i=$2
else
  #Try to find biggest zoom size
  let i=0
  while true; do
    if wget $URL/$i-0-0.jpg --spider -v -O/dev/null 2>&1 | grep "Remote file exists\." 1> /dev/null
    then
      echo "$i-0-0.jpg exists"
      max_i=$i
    else
      break
    fi
    let i++
  done
fi

#let max_i=4

#Try to find biggest first index
let j=0 max_j=0
while true; do
  if wget $URL/$max_i-$j-0.jpg -v 2>&1 | grep "image/jpeg" 1> /dev/null
  then
    echo "$max_i-$j-0.jpg exists"
    max_j=$j
  else
    # clean up
    rm -f $max_i-$j-0.jpg
    break
  fi
  let j++
done

#let max_j=12

#Try to find biggest second index
let k=1 max_k=0
while true; do
  if wget $URL/$max_i-0-$k.jpg -v 2>&1 | grep "image/jpeg" 1> /dev/null
  then
    echo "$max_i-0-$k.jpg exists"
    max_k=$k
  else
    # clean up
    rm -f $max_i-0-$k.jpg
    break
  fi
  let k++
done

#let max_k=8

let j=1
while ((j<=max_j)); do
  let k=1
  while ((k<=max_k)); do
    if wget $URL/$max_i-$j-$k.jpg -v 2>&1 | grep "image/jpeg" 1> /dev/null
    then
      echo "$max_i-$j-$k.jpg exists"
    else
      echo "$max_i-$j-$k.jpg not found!"
    fi
    let k++
  done
  let j++
done

# get list of images in an order that montage will understand
list=""
let k=0
while ((k<=max_k)); do
  let j=0
  while ((j<=max_j)); do
    list="$list $max_i-$j-$k.jpg"
    let j++
  done
  let k++
done

let tile_y=max_j+1
let tile_x=max_k+1

montage $list -tile ${tile_y}x${tile_x} -geometry +0+0 -quality 100 $final.jpg
# clean up
rm -f $list
Then you can issue:
./christies "http://www.christies.com/lotfinder/sculptures-statues-figures/jeff-koons-winter-bears-5408907-details.aspx?from=searchresults&intObjectID=5408907&sid=275b24b4-22e5-4277-8e72-36c4708279d8"
Just be sure to put quotes around the url.