feat: add croissant cake and cream toast

This commit is contained in:
Yanchen
2026-11-15 14:47:19 +08:00
parent 036ee25a2a
commit e784ef07a8
22 changed files with 559 additions and 129 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,100 @@
import html
import json
import re
import subprocess
import urllib.parse
from pathlib import Path
OUT = Path(__file__).resolve().parent
OUT.mkdir(parents=True, exist_ok=True)
AGENT = "PerfectCoffeeAssetResearch/1.0"
COMMONS = {
"milk_bottle": "Bottle of milk.jpg",
"croissant": "Croissant 1.jpg",
"cake_slice": "Slice of chocolate cake.jpg",
"cream_toast": "Buttered toast.jpg",
}
def fetch(url):
return subprocess.check_output(
["curl", "-sSL", "--fail", "--max-time", "45", "-A", AGENT, url]
)
sources = []
for name, title in COMMONS.items():
query = urllib.parse.urlencode({
"action": "query",
"format": "json",
"prop": "imageinfo",
"iiprop": "url|extmetadata",
"iiurlwidth": "1000",
"titles": "File:" + title,
})
data = json.loads(fetch("https://commons.wikimedia.org/w/api.php?" + query))
info = next(iter(data["query"]["pages"].values()))["imageinfo"][0]
metadata = info["extmetadata"]
target = OUT / (name + ".jpg")
target.write_bytes(fetch(info["thumburl"]))
sources.append({
"asset": name,
"file": target.name,
"title": info.get("descriptionurl", title).rsplit("/", 1)[-1],
"page_url": info["descriptionurl"],
"image_url": info["thumburl"],
"creator": html.unescape(re.sub(r"<[^>]+>", "", metadata.get("Artist", {}).get("value", ""))),
"license": metadata.get("LicenseShortName", {}).get("value"),
"license_url": metadata.get("LicenseUrl", {}).get("value"),
"usage": "Visual shape reference only; no photographic texture is used in the models.",
})
product_references = [
{
"asset": "milk_2l",
"file": "milk_2l_woolworths.png",
"title": "Woolworths Full Cream Milk 2L",
"page_url": "https://www.woolworths.com.au/shop/productdetails/888137/woolworths-full-cream-milk",
"image_url": "https://www.woolworths.com.au/shop/productdetails/888137/woolworths-full-cream-milk",
"creator": "Woolworths",
"license": "Product photo; internal visual reference only",
"usage": "User-specified rectangular body, chamfered base, tapered shoulders and integral arched handle opening. No label used.",
"local_capture": True,
},
{
"asset": "milk_2l_supplier_previous",
"file": "milk_2l_supplier.jpg",
"title": "2 Litre 2000ml HDPE Plastic Bottle for Milk Juice with Handle",
"page_url": "https://zhenghaoplastic.en.made-in-china.com/product/lmCRJEMTawkb/China-2-Litre-2000ml-HDPE-Plastic-Bottle-for-Milk-Juice-Food-Grade-Plastic-Bottle-with-Handle.html",
"image_url": "https://image.made-in-china.com/2f0j00tvhbymoGfOca/2-Litre-2000ml-HDPE-Plastic-Bottle-for-Milk-Juice-Food-Grade-Plastic-Bottle-with-Handle.jpg",
"creator": "Shenzhen Zhenghao Plastic & Mold Co., Ltd",
"license": "Supplier product photo; internal visual reference only",
"usage": "2L capacity, HDPE body and integral handle. No supplier branding or labels used.",
},
{
"asset": "orange_juice_2l",
"file": "orange_juice_2l_product.webp",
"title": "Rita NFC Orange Juice Drink 2L PET Bottle",
"page_url": "https://ritabeverage.com/products/fruit-drink/rita-nfc-orange-juice-drink-2l-pet-bottle",
"image_url": "https://ritabeverage.com/media/zoo/images/Rita_NFC_Orange_Juice_Drink_2L_PET_Bottle_9007b71ded187b8476887cf78c0d5446.webp",
"creator": "Rita Food & Drink Co., Ltd",
"license": "Supplier product photo; internal visual reference only",
"usage": "2L clear PET silhouette, neck and screw cap only; no branding or labels used.",
},
]
for source in product_references:
if source.get("local_capture"):
assert (OUT / source["file"]).is_file(), "Supply the saved product-page reference crop"
else:
(OUT / source["file"]).write_bytes(fetch(source["image_url"]))
sources.append(source)
(OUT / "sources.json").write_text(
json.dumps({
"accessed": "2026-11-15",
"notes": "References inform proportions and recognizable features. Models are original low-poly geometry, without brand graphics or packaging labels.",
"references": sources,
}, ensure_ascii=False, indent=2) + "\n",
encoding="utf-8",
)
print(f"Saved {len(sources)} reference photos to {OUT}")
@@ -0,0 +1,81 @@
{
"accessed": "2026-11-15",
"notes": "References inform proportions and recognizable features. Models are original low-poly geometry, without brand graphics or packaging labels.",
"references": [
{
"asset": "milk_bottle",
"file": "milk_bottle.jpg",
"title": "File:Bottle_of_milk.jpg",
"page_url": "https://commons.wikimedia.org/wiki/File:Bottle_of_milk.jpg",
"image_url": "https://upload.wikimedia.org/wikipedia/commons/9/9c/Bottle_of_milk.jpg?utm_source=commons.wikimedia.org&utm_campaign=imageinfo&utm_content=thumbnail_unscaled",
"creator": "Rlsheehan",
"license": "CC BY-SA 4.0",
"license_url": "https://creativecommons.org/licenses/by-sa/4.0",
"usage": "Visual shape reference only; no photographic texture is used in the models."
},
{
"asset": "croissant",
"file": "croissant.jpg",
"title": "File:Croissant_1.jpg",
"page_url": "https://commons.wikimedia.org/wiki/File:Croissant_1.jpg",
"image_url": "https://thumb.wikimedia.org/wikipedia/commons/thumb/2/2e/Croissant_1.jpg/1280px-Croissant_1.jpg?utm_source=commons.wikimedia.org&utm_campaign=imageinfo&utm_content=thumbnail",
"creator": "Gaurav Dhwaj Khadka",
"license": "CC BY-SA 4.0",
"license_url": "https://creativecommons.org/licenses/by-sa/4.0",
"usage": "Visual shape reference only; no photographic texture is used in the models."
},
{
"asset": "cake_slice",
"file": "cake_slice.jpg",
"title": "File:Slice_of_chocolate_cake.jpg",
"page_url": "https://commons.wikimedia.org/wiki/File:Slice_of_chocolate_cake.jpg",
"image_url": "https://thumb.wikimedia.org/wikipedia/commons/thumb/8/8d/Slice_of_chocolate_cake.jpg/1280px-Slice_of_chocolate_cake.jpg?utm_source=commons.wikimedia.org&utm_campaign=imageinfo&utm_content=thumbnail",
"creator": "Ruth Hartnup from Vancouver, Canada",
"license": "CC BY 2.0",
"license_url": "https://creativecommons.org/licenses/by/2.0",
"usage": "Visual shape reference only; no photographic texture is used in the models."
},
{
"asset": "cream_toast",
"file": "cream_toast.jpg",
"title": "File:Buttered_toast.jpg",
"page_url": "https://commons.wikimedia.org/wiki/File:Buttered_toast.jpg",
"image_url": "https://thumb.wikimedia.org/wikipedia/commons/thumb/a/a9/Buttered_toast.jpg/1280px-Buttered_toast.jpg?utm_source=commons.wikimedia.org&utm_campaign=imageinfo&utm_content=thumbnail",
"creator": "Acabashi",
"license": "CC BY-SA 4.0",
"license_url": "https://creativecommons.org/licenses/by-sa/4.0",
"usage": "Toast silhouette and pale-yellow spread only; the model uses one plain cream layer, without photographic textures or extra toppings."
},
{
"asset": "milk_2l",
"file": "milk_2l_woolworths.png",
"title": "Woolworths Full Cream Milk 2L",
"page_url": "https://www.woolworths.com.au/shop/productdetails/888137/woolworths-full-cream-milk",
"image_url": "https://www.woolworths.com.au/shop/productdetails/888137/woolworths-full-cream-milk",
"creator": "Woolworths",
"license": "Product photo; internal visual reference only",
"usage": "User-specified rectangular body, chamfered base, tapered shoulders and integral arched handle opening. No label used.",
"local_capture": true
},
{
"asset": "milk_2l_supplier_previous",
"file": "milk_2l_supplier.jpg",
"title": "2 Litre 2000ml HDPE Plastic Bottle for Milk Juice with Handle",
"page_url": "https://zhenghaoplastic.en.made-in-china.com/product/lmCRJEMTawkb/China-2-Litre-2000ml-HDPE-Plastic-Bottle-for-Milk-Juice-Food-Grade-Plastic-Bottle-with-Handle.html",
"image_url": "https://image.made-in-china.com/2f0j00tvhbymoGfOca/2-Litre-2000ml-HDPE-Plastic-Bottle-for-Milk-Juice-Food-Grade-Plastic-Bottle-with-Handle.jpg",
"creator": "Shenzhen Zhenghao Plastic & Mold Co., Ltd",
"license": "Supplier product photo; internal visual reference only",
"usage": "2L capacity, HDPE body and integral handle. No supplier branding or labels used."
},
{
"asset": "orange_juice_2l",
"file": "orange_juice_2l_product.webp",
"title": "Rita NFC Orange Juice Drink 2L PET Bottle",
"page_url": "https://ritabeverage.com/products/fruit-drink/rita-nfc-orange-juice-drink-2l-pet-bottle",
"image_url": "https://ritabeverage.com/media/zoo/images/Rita_NFC_Orange_Juice_Drink_2L_PET_Bottle_9007b71ded187b8476887cf78c0d5446.webp",
"creator": "Rita Food & Drink Co., Ltd",
"license": "Supplier product photo; internal visual reference only",
"usage": "2L clear PET silhouette, neck and screw cap only; no branding or labels used."
}
]
}