@@ -242,19 +242,19 @@ The definition.json must validate against `components/i2c/schema.json`. Key cons
242242
243243** For Adafruit products:**
244244
245- 1 . ** From Adafruit product API:** ` https://www.adafruit.com/api/product/<PID> ` — the
246- ` product_image ` field gives the default image URL (typically ` 640x480 ` ).
245+ 1 . ** Scrape all image URLs from the product page:** Fetch ` https://www.adafruit.com/product/<PID> `
246+ and extract all ` cdn-shop.adafruit.com ` image URLs. The product page gallery contains every
247+ available shot — don't guess image numbers, as they are not necessarily contiguous.
2472482 . ** CRITICAL — Always use the ` /original/ ` CDN URL, NOT ` 970x728 ` or ` 640x480 ` .**
248249 The Adafruit CDN URL contains a resolution prefix. You MUST replace it with ` original `
249250 to get the highest-resolution source for downscaling. Downloading a pre-scaled version
250251 (e.g. ` 970x728 ` ) produces a blurry 400x300 result.
251252 - ** USE THIS:** ` https://cdn-shop.adafruit.com/original/<PID>-NN.jpg `
252253 - NOT: ` https://cdn-shop.adafruit.com/970x728/<PID>-NN.jpg `
253254 - NOT: ` https://cdn-shop.adafruit.com/640x480/<PID>-NN.jpg `
254- - Where ` NN ` is the image number (` 01 ` = default, ` 00 ` and up are common variants)
255- - If you scraped a URL from the product page or API, replace the resolution part
255+ - For each image URL scraped from the product page, replace the resolution part
256256 (e.g. ` 970x728 ` , ` 640x480 ` ) with ` original ` before downloading
257- 3 . ** Check all available shots** by incrementing from ` 00 ` until you get a 404 — pick the slight-angle / isometric
257+ 3 . ** Check all available shots** from the scraped URLs — pick the slight-angle / isometric
258258 close-up of the breakout board with a plain background (this is the standard Adafruit product
259259 photo style, typically image ` 00 ` ). Avoid lifestyle shots, shots with other boards or
260260 accessories in the frame, or images where the board is very small in the frame.
@@ -390,7 +390,7 @@ import urllib.request, io, os
390390
391391# 1. Download original resolution source (best quality)
392392PID = ' <product_id>'
393- IMAGE_NUM = ' 01' # try 00, 01, 02, ... until 404 to find best shot
393+ IMAGE_NUM = ' 01' # use image numbers scraped from product page
394394url = f ' https://cdn-shop.adafruit.com/original/ { PID } - { IMAGE_NUM } .jpg '
395395data = urllib.request.urlopen(url).read()
396396img = Image.open(io.BytesIO(data))
0 commit comments