Just as product detail URLs follow a certain pattern, image URLs are just as predictable.
Just as every page has a URL, so too does every product image. Finding the URL is fairly easy in most browsers. In Internet Explorer on Windows, right-click the image and choose Properties. Once you have the image URL, you can bring it up in the browser by placing it in the address bar. Some browsers—Safari for Mac OS X, for instance—make this a single step via the Open Image in New Window context-menu item.
Amazon image URLs are just as dynamic as Amazon pages. By understanding the image URL pattern, you can find images for products based on their ASIN and customize from there.
For instance, the following standard image URL brings up a standard product image, the Google Hacks book cover in Figure 1-6:
http://images.amazon.com/images/P/0596004478.01._PE30_PI_SCMZZZZZZZ_.jpg
If you’re getting good at spotting ASINs [Hack #1], you’ll see this product’s ASIN in the URL. By changing it, you can find the image for other products (see Figure 1-7):
http://images.amazon.com/images/P/0596004613
.01._PE30_PI_SCMZZZZZZZ_.jpg
Keep in mind that you can link to an image of any product that Amazon sells, as long as you have the ASIN. The following URL shows an iPod MP3 player from Amazon’s Electronics catalog (see Figure 1-8):
http://images.amazon.com/images/P/B00006FDRB.01._PE30_PI_SCMZZZZZZZ_.jpg
These images have something else in common: a 30%
off graphic in the lower-right corner. With closer
examination of the URLs, you can see what might be affecting the
graphic. The section PE30
corresponds with the
discount amount. What happens if we change this value?
http://images.amazon.com/images/P/0596004605.01._PE50_PI_SCMZZZZZZZ_.jpg
The PE50
changes the discount to 50%, as seen in
Figure 1-9.
Warning
Just because you can change the discount information on the image doesn’t mean you should. Giving false information about products will only upset potential customers and potentially Amazon.
What if you didn’t want a discount at all? Take out the discount designation for a discount-free image like that shown in Figure 1-10:
http://images.amazon.com/images/P/0596004605.01._SCMZZZZZZZ_.jpg
Different sizes of images are also predictable and can be requested with a URL. The portion of the URL with all those ZZZ’s specifies its size. The codes and their associated sizes are listed in Table 1-1.
Table 1-1. Image codes and their associated images sizes
Image code |
Image size |
---|---|
THUMBZZZ |
40 x 60 pixels, very small |
MZZZZZZZ |
93 x 140 pixels, standard size |
LZZZZZZZ |
317 x 475 pixels, very large |
The actual pixel size will vary by item, but these are good approximations for books.
By looking at
the URLs for different products, you
may even pick up other variable style codes. Throwing a
TT
in the mix (as Duke Bhuphaibool at Amazon
suggested) tilts the product image, shown in Figure 1-11:
http://images.amazon.com/images/P/0596004478.01.20TT
ZZZZ.jpg
And TR
sets it
straight again:
http://images.amazon.com/images/P/0596004478.01.20TR
ZZZZ.jpg
Most product images on Amazon are JPEG files, but there is a way to force the GIF format:
http://images.amazon.com/images/P/0596004478.01._FMgif_
ZZZZZZZZZZ_.gif
Unfortunately, you’re stuck with the medium size. There isn’t a way to request a larger GIF.
Get Amazon Hacks now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.