Abusing Amazon images

by Nat Gertler

Created May 21, 2005. Last updated January 10, 2014. Thanks to Aryeh Leib Taurog for the hover code.

Amazon.com feeds out a lot of product images, putting out the same book
cover (say) in a variety of sizes and formats. By experimentation, I
found that they don't actually have all the sizes and formats stored.
Instead, they have a system that generates each requested image. The
details of size and format are built into the image's URL. What that
means that, if you want, you can create URLs that generate odd and unlikely
Amazon images (you can see my gallery of images here).
The proper combination of product choice and added elements and effects
could create an interesting visual. What you see here is my best understanding
of things based on trial and error and messing with various example URLs I've
found. Hover over the example images to see the full address of the image.

The
first part -http://ezw.images-amazon.com/images/ - varies for some of the
foreign Amazon sites. You may see http://ec2.images-amazon.com/images/ but this
appears to have no impact on the image that results. (You may see older links to images using http://images.amazon.com/images/ on non-Amazon sites, which is the old location and which still works.)

The next part - P/ - indicates the format of the product code.
The rest is a series of variable fields, each field separated from the next
by a period (or, for those who live solely in web URLs, a "dot".)

0971633894 is
the product code. There are two formats used for the product code - if the previous part was P/ this is the ASIN, the identifier that Amazon uses for every item
it stocks. For books, this is the 10-digit ISBN, stripped of its
dashes. You can find the ASIN in the product details
section of any Amazon product listing. If the previous part was I/ this is some sort of funky 11-digit code that indicates not just the product, but also where the image was originally found. I've not been able to pull this apart into useful information yet, but it does not include some user tracking indicator as I first feared. If you're trying to build your own image generator, stick with the P/ format.

01 used to be
the country field, but now is always set to 01 (although it still works if you want to set the country code). Different Amazons in different countries have different images
stored for individual products, as well as different add-on images and percent-off
bullet formats.
(If there isn't a local version of the image for a country's database, or if
you use an unused country code such as 06, it defaults to the US version.
For at least some Japanese products, there is no US image stored, and no image
will
appear
if
you use
another country
code.)

01:
The US (Amazon.com) and Canada (Amazon.ca) and as best as I can tell, China (Amazon.cn). (This can sometimes
be
followed by a dash and then a fairly long alphanumeric string, then a
.PT01. - this
is for products that have alternate views. Changing that .PT01. to .PT02.
gives the next view, and so forth.)

02:
The UK (Amazon.co.uk). This uses a slightly different bullet design.

03:
Germany (Amazon.de) For a long time, this slot actually held the alternate, original solicitation cover for this book. The Germans didn't get percentage-off bullets until
sometime between August and October of 2005
(and even so, they originally had no
support for discounts of less than 10 percent, although they now do).

08:
France (Amazon.fr)

09:
Japan (Amazon.co.jp)

_PE20_SCMZZZZZZZ_ gives
information on the size of the image and adornments added
to the image. I've found three formats that this field
can have.

THUMBZZZ -
just the size code. This works only for certain
size codes

20SCZZZZ -
(NOTE: AS OF AUGUST 2008, THIS FORMAT APPEARS TO BE DISABLED, RETURNING JUST AN IMAGE WITH NO BULLET.) the percent discount followed by the size code.
This only works with certain size codes. Using
00 will generate an image without a bullet, while 1C presents a special one
cent bullet. (The one cent bullet is only available for country code 01.)

_PE20_SCMZZZZZZZ_ -
a string of commands separated by underscores, including
lead and end underscores. A list of known size
codes and commands is below.

jpg -
This can be jpg, jpeg,
png,
or gif.
Oddly, it doesn't matter. The file will be a JPEG format
graphics file no matter what extension you use (unless you vary it with the
FM code descrbed below). You can even get away with using no extension, with
or without the leading period. However, you can't just put random
characters for the extension.

size codes

The size codes that I've found all seem a mite odd to
me. They all end in a number of Zs, and I imagine there
is some significance to the number that I've not found,
but you can't just mess with them. Each size code works only with a certain option format

Option format 1

THUMB (can be followed by any number of Zs) or H

small size.

T (can be followed by any number of Zs)

medium image size.

Any other (or no) string

default image size

Note: Before August, 2008, ZTZZZZZZ or any other eight-letter string starting with the second letter being T would add a drop shadow to the left, unless the fourth letter was an L, in which case it would drop right.

Prior to July 2006, these commands
also tilted the image to the left, unless the third or fourth letter
was an R, in which case the tilt was to the right.

L, LZ, or LZZ

large size.

Option format 2

As of August 2008, option format 2 (with a bullet value followed by a string which could cause a tilt or a drop shadow) is no longer working; anything designed for format 2 is simply treated as format 1.

Option format 3

SCTZZZZZZZ

small size.

SCMZZZZZZZ

medium
size.

SCLZZZZZZZ

large size.

SCRM

HUGE size.

Too huge to fit comfortably on this web page - we're talking megapixel images. Please note that this option is only available for items that have a ZOOMing picture on its amazon web page, and it doesn't work for all of the domain names - but if you have a page with a zoomable picture, try doing this with ec2.images-amazon.com as the host. Click here for an example image

commands

Borders and Shadows

PB -
Put a drop shadow on the image, down and to the left. Note:

PC -
Put a drop shadow on the image, down and to the right.
As of August 2008, these only works if there is at least two underscores following the PB or PC in the command string (they need not be directly in a row; they can follow other commands) or there are further arguments.These are only designed to look like a real shadow for
rectangular items such as books. If you want it to look
like a real shadow, make sure to put this command before
any PE, PI,or rotate command. If you add an argument to it (such as PC,4) the
total image size is reduced, unless you add exactly five arguments, as in PC10,129,75,55,33,
in which case blank space is added around the edges of the image. This will
add 10 pixels to both the width and the height,
then add 129 pixels just to
the height, then add 75 just to the width. I haven't
yet found what effect the 55and 33 have.

PA10,6,-8,20 -
This is a more complete drop-shadow tool. The first number is the number of
pixels added to the image in each dimension, generally just adding blank area.
The second is how far the shadow's edge is from the item's edge horizontally
in pixels (positive values go to the right, negative to the left). The third
is how far the shadow's edge is from the image's edge vertically (positive
values go down, negative values go up.) The final number sets how sharp and
dark the shadow is - 0 would be perfectly square, while higher numbers make
the shadow ever fuzzier and lighter.

BO10,155,0,145-
Adds a border around the picture. The first number is the border thickness
in pixels, and can be up to at least four digits long, which is more than
you'll ever need. The remaining three values are the border color in decimal-represented
RGB. For those of you who aren't so versed in geekspeak, what this means is
you're mixing a color together using red, green, and blue. There's a number
for the amount of red (running from 0 to 255), followed by one for the amount
of green, followed by one for the amount of blue.

Bullets and adornments

PF -
Puts a half-disc image sticking out of the side of the
product.Adding a value after this decreases the size of the existing image
and adds space between the existing image and the disk image. (As of August 2008, if PF is your only argument, include an extra underscore after it or it won't work properly.)

PE55 -
Puts a percent discount bullet on the lower right of the image. Value
can be 01-99; 00 means no bullet, 1C is a one cent bullet. (The one cent
bullet
is only available if the country code is set to 01.)

PD55 -
Same as PE except the bullet is on the lower left.

PIsm.arrow,TopLeft,-2,-19 or PJsm.arrow,TopLeft,-2,-19 -
Adds another sort of bullet to the image. (PI adds whitespace around the image when it does so; PJ does not, unless the bullet goes beyond the edge of the image)

sm.arrow -
the type of bullet. So far, the bullets that I've
found are:

The
following only work with country code 01 (the US/Canada)

sitb-dp-500-arrow

litb-dp-500-arrow

("sitb" means "Search
Inside The Book")

.

("litb" means "Look Inside The
Book")

look-inside-v2

look-inside

release-day-del-sticker

bundle-808

clearance

Works not only for 808, but also for all values
2-25,30,35,40,50,60, and 70.

The
following only work with country codes 01 and 02 (the
US/Canada and the UK)

dp-schmooS

dp-schmoo2

(a "shmoo" is a white bulbous creature
from the Li'l Abner comic strip that the little figure here
resembles.)

The
following put out a different image based on country code

Code

sitb-st-arrow

sitb-sm-arrow

sitb-sticker-dp-arrow

sitb-sticker-dp-top

01/02

03

08

09

Code

sitb-sticker-arrow-dp

sitb-sticker-arrow-click

01/02

03

08

09

The
following only work with country code 02 (the UK)

uk-r-fp-299

uk-y-fp-9999

uk-r-fd-1

uk-y-fd-18

These values can be set to 299,
399, and so on up to 9999, plus 19999.

This values can be anything from
1 to 18, 20, 30, 40, 50, or 100

This values can be anything from 1 to 20,
30, 40, 50, or 100

uk-r-ss-new

uk-y-ss-new

uk-r-ss-save

uk-y-ss-save

The
following only work with country code 03 (Germany)

sticker-neu-r

mit-praemie-sticker3

de-ambir-sticker-o

sticker-preishit-r

"New"

"Premium"

"Hit Price"

This doesn't seem to work on the old image server format

autoripBadge

=

TopLeft -
where the placement of the bullet is measured from.
TopLeft, TopRight, BottomLeft and BottomRight all
work. TopLeft is the default,if you enter meaningless
data here.

-2,-19 -
the placement of the bullet. The first number is
horizontal - positive values place to the right,
negative values to the left. The second number
is vertical - positive down, negative up.

The following image codes have been discontinued: m.arrow (country 01), st.arrow and t.arrow (countries 01 and 02), and sm.arrow (countries 01, 02, and 03). These were search-inside-type arrows without the trademark, if memory serves. Also disabled from country code 01: kin-dp-500 (I no longer recall what this was) and m.schmu (which was one of the little white blobby guys peeking over the edge of things.)

PGsitb-sm-arrowand
PHsitb-sm-arrow-
Stretches the bullet to take up the full width of the image.
PG places it on the bottom of the image, PH on the top.

sitb-sm-arrow -
Any of the bullets from the above list.

OU02 -
This overrides the country-code setting for which bullets can be
displayed, while still using the original country code setting for the
selection
of the product image:

OU01 (use
the US/Canada bullets)

OU02 (use
the UK bullets)

OU03 (use
the German bullets)

OU08 (use
the French bullets)

OU09 (use
the Japanese bullets)

Note that OU has the same effect no matter where in your command
string it lands (although if you have two OU commands, only
the first is used.)

ZAText%20stuff,5,15,100,100,times,20,255,40,240 -
Adds text. That's a long command, but it has a lot of stuff. When writing
out the text content, you may run into problems if you use characters
that are not letters or numbers (such as spaces, commas, and so forth),
because
they may be misinterpreted in a URL. Instead, you have to use encoded
ASCII values. Use %20 for a space, %2C for a comma, %2E for a period,
and go here to
look up other characters. The next two fields (5,15) are the position
of the upper left corner of the text area, measured from the upper left
corner
of the image. In this case, it's 5 pixels down, 15 to the right. The
next two figures show where the bottom right of the text area is, 100
pixels
to the right and 100 down from upper left of the text box. This is
important because word wrap will be done based on where the right edge
of the text
box is. After that is the font, and so far I've identified five: times, arial,
arialbi (arial bold italic), verdenab (which
is presumably some sort of misspelling of verdana, a common
font), and advc128d (a bar code font, used on package labels
for postal routing and tracking). Next (20) is the font size, and then
a three-digit RGB code for the
text
color. (You can see RGB codes explained in the BO command discussion.)

ZC -
The same as ZA, except that it places the text box so that the longest
line of text in the box is centered on the image. This is good centering
if you have only one line of text. It doesn't center each individual
line so the left edge of shorter lines will still lign up with the left
edge
of the longest line.

Size adjustment

AA25 -
This resizes the image to a fixed pixel dimension (setting its larger dimension,
with the smaller one set in proper proportion). It seems
like you can set any number up to the actual size that
the image is stored at Amazon; above that, this adds
white space to around the borders of your image. Expanding
to the point where you're adding white space also appears
to shrink the bullet. (I need to do a little more exploring
here to get the details worked out.) Values from 1 to
at least 5000, by which point you're so far beyond the
size of any actual image at Amazon that there's no point
in thinking about it.

SX25 -
This reduces the image to be the listed number of pixels in width, with
the height being reduced proportionately.

SY25 -
This reduces the image to be the listed number of pixels in height, with
the width being resized proportionately.

SL25 -
This reduces the size of the image so that the larger dimension (width or
height) becomes the size listed, with the smaller dimension reduced proportionately. If
the value is larger than the larger dimension size that would otherwise
be put out, this has no effect on the image.

SS25 -
This resizes the image to a square image, a fixed number of pixels in both
height and width. It does this not by distorting the image, but by scaling
the image so that the larger dimension is the listed size and blank white
pixels are added to the side to fill it out. If you set a value larger than
the actual size of the source image as stored on the Amazon server, white
space will be added all around the image.

CR0,10,20,15 -
This crops the image, trimming away everything but a selected rectangular
area. The first two numbers indicate the upper left-hand corner of the selection
area (the first is how many pixels from the left, the second is how many
pixels down from the top). The next two numbers are the width and height
of the selected area, in pixels.Note: this was a great way to trim away
the excess white space left by other commands,,. which other commands used to create, although that was greatly reduced sometime around July 2007. You have to take
the time to crop precisely for a given image. If you set the crop area
to go beyond the edge of the image, the image will merely be resized with
white space added.

Rotation

PT85 -
Tilts the image. Number is number of degrees. Default (no number)
is 0. The values seem to range as high as 135. Positive values rotate
to the right, negative numbers rotate to the left. Negative numbers go...
well, I stopped testing in the hundreds of millions, but
there's
not much
need to go beyond -360, which takes it full circle. Positive rotations
in some values seem to cause severe image shrinkage, so you should consider
using a size adjustment after rotation.

PU45 -
Tilts the image to the left. Number is number of degrees. Default
(no number) is about 5 (although ends up with slightly different size image than actually using 5). Range is 0-99.

PV45 -
Same as PU, except tilting to the right. Note: PU and PV stopped functioning around July 2006, but were restored by July 2007

Image Adjustments

HL60,100,30,15,80 -
This highlights an area of the image. The first two numbers indicate
the upper left-hand corner of the highlighted area (the first is how
many pixels from
the left, the second is how many pixels down from the top). The next
two numbers are the width and height of the highlighted area, in pixels.
The fifth number
is the degree of adjustment. Values from 0 through 255 give an ever more
solid color, with 255 leaving the block solid. (Values above
255 just repeat the 0-255 range.) For cool effects, however, you should
try negative values.

BL10 -
This blurs the image. The number appears to be the blur raidius,
so the larger a number you enter, the blurrier your image will get..

SH94 -
This sharpens the image, increasing the contrast between adjacent pixels of
different color to make the difference stand out. Values are 00-99. Small
values (say, 20) can have a nice effect on images that don't look distinct.
Large values find insignificant color differences and turn them into noise
while draining the image of color.

FMgif -
This sets the output format of the file. Acceptable arguments are jpg
(the default), jpeg (same format), gif, and png. Be careful with this
command - whereas messing up your argument for most options will at
worst output a blank image file, messing up this one will give you
a 404-file not found response.

BD1 - This
options works only with the FMgif option (file format set to gif.)
This sets the bit depth, the number of bits that the file uses to represent
each pixel. Values range from 1 (which will mean that your entire image
only has 2 colors) to 8 (256 colors).

The
cool thing (if you want to generate unlikely Amazon images)
is that you're not limited to one use of any of these commands.
You can have multiple discounts, multiple shadows, multiple
bullets, generating images that Amazon would never have
on its site. However, every additional command you add generates
another 10% to the image dimensions, adding white space
around the image. And that 10% compounds; add a lot of
bullets, and you'll find that you have a small image in
a large blank space. (You can use the CR command to cut away the excess, however.)
Note also that the commands are interpreted in order, which can have an impact
on
what
overlaps
what.

other images

There are other, non-product images lurking around Amazon which you can similarly
abuse. In fact, any image coming from images.amazon.com or g-images.amazon.com
can be subject to this. There are some images that were specifically designed
for such use. For example, at

you will find ,
which is designed to be used with the ZC tag to list price discounts, like or .

At http://images.amazon.com/images/G/01/nav/personalized/tabs/yourstore-off-sliced.gif

you find ,
which was used in an old set of Amazon page headers to personalize things
like .
But if you check the source for any image you see on Amazon's pages, you
can probably abuse it. Just add a period followed by a string of commands
before the .gif or .jpg at the end of the image name.

on beyond...

Are there other secrets, other commands, other things to
be discovered about the Amazon product image system? Almost certainly.

Note: all of the product images on this page are coming
directly from Amazon. If you don't quite get the URL information
being discussed, right-click (Windows) or ctrl-click (Mac)
on the image, and chose your browsers command to view the
image, or to copy the image address which you can then
paste into the address field of your browser. Your address
field will have the full URL for you to study!

Abusing Amazon images for decorative art on your own web
pages makes use of Amazon's processor and bandwidth. While Amazon is generally
good about letting people use their systems for interesting projects,
it should be remembered that they make access available in order to ultimately
sell more stuff.

My recommendation for those who want to use Amazon's services
without being a total leech is to be sure to include a link to the Amazon
sales page for the product depicted. For example, all the images on this
page are for It's Only a Game, a
collection of a non-Peanuts newspaper comic by the creator of Peanuts.

If you're using various overlay images, particularly percentage
bullets, include something like:

Warning: the discount percentages and other feature
blurbs depicted on this page are being used in a purely decorative fashion.
They don't represent any discount or feature actually being offered.