Amazon and Zillow both write the image size into the photo's address. Change that part and the CDN sends a different copy. On Amazon the rule is simple: delete the size code and you get the uploaded file. On Zillow there are three families of size codes, the biggest copy crops portrait photos, and one family upscales small ones.

I measured both for the full-size rules in my extension, first in November and again today, 5 December, with curl. Below are the address patterns, what each code returned, and the rule I ended up shipping for each site.

Amazon: everything between the ID and .jpg is the size

A product photo address looks like this:

https://m.media-amazon.com/images/I/61fd2oCrvyL._AC_SX342_.jpg 

61fd2oCrvyL is the image ID. ._AC_SX342_ sets the size. On the listing I tested (amazon.com/dp/B0BSHF7WHW, a MacBook Pro), the main photo is shown at 342 px wide, the zoom image in data-old-hires ends in ._AC_SL1500_, and the gallery thumbnails end in ._AC_SR38,50_ and are 38 × 50 px.

What the same photo returns with different endings:

Address ends in What came back
._AC_SX342_.jpg 342 × 209, the copy on the page
._AC_SX679_.jpg 679 × 415, 21,760 bytes
._AC_SL1500_.jpg 1500 × 918, 67,420 bytes
._SL2000_.jpg 2000 × 2000
.jpg (code deleted) 2560 × 2560, 118,695 bytes

The 1500 × 918 copy is shorter because _AC_ trims the white margin around the product before scaling. The address with no code keeps the margin and has every pixel that was uploaded.

On 22 November I tried four more photos, with IDs taken from Bing image results because Amazon gave my script a robot check instead of a product page. With no size code they came back at 1500, 1600, 1000 and 1601 px on the long side. The address without a code was the largest copy every time.

Asking for more pixels than the photo has does nothing. ._SL3000_ returned exactly the same bytes as the address with no code, for all five photos. I re-ran two of them today: 61-1daSWPbL._SL3000_.jpg and 61-1daSWPbL.jpg are both 1500 × 1500, 129,258 bytes, with the same MD5. So there is no point guessing a bigger SL number.

Format was boring in a good way. All 70 responses on 22 November were image/jpeg, with or without Chrome's Accept: image/avif,image/webp,... header, and the bytes did not change between the two. Some CDNs swap in WebP or AVIF when the browser says it accepts them; this one does not.

The rule in the extension is one regex on the path:

{ id: 'amazon', test: (u) => /(^|\.)media-amazon\.com$|(^|\.)ssl-images-amazon\.com$/.test(u.hostname), apply: (u) => { u.pathname = u.pathname.replace(/\._[^/]*?_\.(jpe?g|png|webp|gif)$/i, '.$1'); }, } 

It runs on every image URL found on the page. The 38 × 50 thumbnails upgrade to the 2560 px upload too, which matters for one more reason: the size filter in my popup measures the copy shown on the page, so it has to let those thumbnails through instead of dropping them as tiny.

One thing the rule cannot do is pick the cropped copy. If you want the product without its white margin, ._AC_SL1500_ is closer to what you need, at fewer pixels.

Zillow: the suffix names a box, and some boxes crop

Zillow photos live on one host with a fixed shape:

https://photos.zillowstatic.com/fp/<32 hex chars>-<suffix>.<jpg|webp> 

On 8 November one for-sale listing in Austin had 61 photo IDs in its markup, with these suffix families:

  • sc_192_128 up to sc_1920_1280 (30 IDs)
  • sr_576_384 up to sr_1920_1280 (13 IDs)
  • cc_ft_192 up to cc_ft_1536, plus p_d (28 IDs, the nearby-home cards)
  • a few others: h_l, a_b, logos

The page itself was behind a bot wall for headless Chrome and curl, but the photo host answered curl with HTTP 200. Here is one photo, fetched today:

Suffix Size Bytes
sr_576_384.webp 576 × 384 22,950
o_a.jpg 1024 × 683 107,490
uncropped_scaled_within_1536_1152.jpg 1536 × 1024 229,939
cc_ft_1536.jpg 1536 × 1152 249,424
sc_1920_1280.jpg 1920 × 1280 287,541
sc_2400_1600.jpg HTTP 404

The pixel sizes are the same as on 1 November. cc_ft_1536 is already a crop: the photo is 3:2 and that copy is 4:3. For this landscape photo, sc_1920_1280 is the biggest file.

That stops being true with other photos. On 8 November I fetched three photos from the same listing with four suffixes each:

Photo sr_1920_1280 sc_1920_1280 cc_ft_1536 uncropped_scaled_within_1536_1152
landscape, 3:2 1920 × 1280 1920 × 1280 1536 × 1152 1536 × 1024
landscape, small source 1920 × 1280, upscaled 1484 × 1060 1484 × 1060 1484 × 1060
portrait 1920 × 1280, cropped 1057 × 1280, cropped 1017 × 1152 793 × 1152

So sr_ always gives you exactly the box you named, upscaling a small source and cropping a portrait one to fit. sc_ does not upscale, but it still crops a portrait photo to 1057 × 1280. The portrait's small copies (o_a 528 × 768, p_f 517 × 768) have the same 0.69 aspect ratio as the uncropped copy, which is how I know the uncropped one is the real shape.

uncropped_scaled_within_1536_1152 does what its name says: it fits the photo inside 1536 × 1152, keeps the aspect ratio, and never upscales. Of 51 photo IDs fetched that way, 42 came back 1536 × 1024, 8 were smaller landscapes between 1206 and 1536 px wide, and 1 was the portrait at 793 × 1152.

The Zillow rule, and what it costs

I went with the uncropped copy for every Zillow photo:

{ id: 'zillow', test: (u) => u.hostname === 'photos.zillowstatic.com' && /^\/fp\/[0-9a-f]{32}-(?!uncropped_scaled_within_1536_1152\.jpg$)[a-z0-9_]+\.(jpe?g|webp|png)$/i.test(u.pathname), apply: (u) => { u.pathname = u.pathname.replace(/-[a-z0-9_]+\.(jpe?g|webp|png)$/i, '-uncropped_scaled_within_1536_1152.jpg'); }, } 

Running it on suffixes from the page:

URL in Fetched after the rewrite
-sc_1920_1280.webp 1536 × 1024
-sr_576_384.jpg 1484 × 1060
-sc_192_128.webp 1536 × 1024
-cc_ft_1536.jpg (portrait) 793 × 1152
-p_d.jpg 1536 × 1024

The price is 384 px of width on a normal landscape photo, since the page's own sc_1920_1280 would have been 1920 wide. In exchange, no portrait photo gets cut. Picking per photo would need the aspect ratio before the download, which means an extra request per photo, and I did not think that was worth it for a real estate listing.

The markup also moved under me. On 2 November the biggest copy any <picture> source offered on a listing page was sr_576_384, so an extension that trusted srcset saved 576 px files. Six days later the sources went up to sc_1920_1280. The rewrite rule doesn't care which suffix the page uses, which is the main reason I prefer a rule over reading srcset on sites like this.

Reading sizes without opening the files

All the sizes above come from the JPEG's start-of-frame marker, not from Content-Length or the URL. This is the throwaway script I used today:

from struct import unpack def jpeg_size(path): b = open(path, 'rb').read() i = 2 while i < len(b): marker = b[i + 1] length = unpack('>H', b[i + 2:i + 4])[0] if marker in (0xC0, 0xC1, 0xC2): h, w = unpack('>HH', b[i + 5:i + 9]) return w, h i += 2 + length 

For WebP files, file on Linux prints the dimensions directly.

What carried over from these two sites

  • The image CDN often answers plain curl even when the product page shows a bot check. Both sites did.
  • Asking for a box bigger than the photo can return the same bytes (Amazon), an upscaled copy (Zillow sr_), or a 404 (Zillow sc_2400_1600). Read the dimensions before you trust a size code.
  • The largest file is not always the one you want. Amazon's upload keeps the white margin, and Zillow's largest copy crops portraits.
  • Re-measure. Zillow's markup changed within a week; the photo host did not.

I wrote up the manual steps for Amazon, including what happens with color and size variants, in how to download Amazon product images in full size. I make PixLasso, a Chrome and Edge extension that applies rules like these two and saves a page's photos as one ZIP.