Image Details
The Product Advertising API returns images in two ways:
-
Under <Item> in the <SmallImage> , <MediumImage> , and <LargeImage> elements.
-
Under <ImageSets> where the image sizes are specified by the _SLXXX_ modifier, where XXX is the number of pixels on the longest side of the image. A medium size image, for example, has 160 pixels on its longest side.
The following response snippet shows the first way in which the image is returned.
<Item> <ASIN>B000Q678OO</ASIN> <SmallImage> <URL>http://ecx.images-amazon.com/images/I/51YL4rlI%2B9L._SL75_.jpg</URL> <Height Units="pixels">75</Height> <Width Units="pixels">58</Width> </SmallImage> <MediumImage> <URL>http://ecx.images-amazon.com/images/I/51YL4rlI%2B9L._SL160_.jpg</URL> <Height Units="pixels">160</Height> <Width Units="pixels">124</Width> </MediumImage> <LargeImage> <URL>http://ecx.images-amazon.com/images/I/51YL4rlI%2B9L.jpg</URL> <Height Units="pixels">500</Height> <Width Units="pixels">389</Width> </LargeImage>
Notice that each image is associated with an item identifier, which, in the preceding example, is an ASIN. The image details include the following:
-
Image's size, which is captured in the elements <SmallImage> , <MediumImage> , and <LargeImage>
-
URL of the image on Amazon's image server
-
Image's height and width measurements in pixels to aid in displaying the images
The standard resolution is 24 bit color and 96 pixels per inch
The following response snippet shows the second way in which the image is returned.
<ImageSets> <ImageSet Category="primary"> <SwatchImage> <URL>http://ecx.images-amazon.com/images/I/51YL4rlI%2B9L._SL30_.jpg</URL> <Height Units="pixels">30</Height> <Width Units="pixels">23</Width> </SwatchImage> <SmallImage> <URL>http://ecx.images-amazon.com/images/I/51YL4rlI%2B9L._SL75_.jpg</URL> <Height Units="pixels">75</Height> <Width Units="pixels">58</Width> </SmallImage> <ThumbnailImage> <URL>http://ecx.images-amazon.com/images/I/51YL4rlI%2B9L._SL75_.jpg</URL> <Height Units="pixels">75</Height> <Width Units="pixels">58</Width> </ThumbnailImage> <TinyImage> <URL>http://ecx.images-amazon.com/images/I/51YL4rlI%2B9L._SL110_.jpg</URL> <Height Units="pixels">110</Height> <Width Units="pixels">86</Width> </TinyImage> <MediumImage> <URL>http://ecx.images-amazon.com/images/I/51YL4rlI%2B9L._SL160_.jpg</URL> <Height Units="pixels">160</Height> <Width Units="pixels">124</Width> </MediumImage> <LargeImage> <URL>http://ecx.images-amazon.com/images/I/51YL4rlI%2B9L.jpg</URL> <Height Units="pixels">500</Height> <Width Units="pixels">389</Width> </LargeImage> </ImageSet> </ImageSets>
The sizes of the images under <ImageSets> are specified by the _SLXXX_ suffix in the URL, where XXX is the number of pixels on the longest side of the image. A medium size image, for example, has 160 pixels on its longest side so it has the suffix _SL160_. This is the preferred way to reference images.
The ImageSets element attribute, Category, is set to Primary. Primary images are the same images that appear in the <Item> section.