diff --git a/Makefile b/Makefile index e46d578..38eb9fc 100644 --- a/Makefile +++ b/Makefile @@ -18,7 +18,7 @@ run-automation: cd recipe_automation && . venv/bin/activate && python main.py # Image standardization target -# Usage: make standardize-image IMAGE=path/to/image.jpg [OUTPUT=path/to/output.jpg] [MAX_WIDTH=800] [MAX_HEIGHT=600] [FORMAT=JPEG] [QUALITY=85] +# Usage: make standardize-image IMAGE=path/to/image.jpg [OUTPUT=path/to/output.jpg] [MAX_WIDTH=800] [MAX_HEIGHT=600] [FORMAT=JPEG] [QUALITY=95] standardize-image: ifndef IMAGE $(error IMAGE is required. Usage: make standardize-image IMAGE=path/to/image.jpg) diff --git a/baking/images/oatmeal-cookies-manual.jpeg b/baking/images/oatmeal-cookies-manual.jpeg new file mode 100644 index 0000000..34d5f0d Binary files /dev/null and b/baking/images/oatmeal-cookies-manual.jpeg differ diff --git a/baking/images/oatmeal-cookies.jpeg b/baking/images/oatmeal-cookies.jpeg new file mode 100644 index 0000000..491b1cb Binary files /dev/null and b/baking/images/oatmeal-cookies.jpeg differ diff --git a/baking/index.md b/baking/index.md index 879900e..f1f8d08 100644 --- a/baking/index.md +++ b/baking/index.md @@ -3,4 +3,5 @@ ## Baking Recipes * [Banana Bread](./banana_bread.md) +* [Oatmeal Chocolate Chip Cookies](./oatmeal-chocolate-chip-cookies.md) * [Peanut Butter Cookies](./peanutbutter-cookies) diff --git a/desserts/oatmeal-chocolate-chip-cookies.md b/baking/oatmeal-chocolate-chip-cookies.md similarity index 89% rename from desserts/oatmeal-chocolate-chip-cookies.md rename to baking/oatmeal-chocolate-chip-cookies.md index 53b531f..8ff5649 100644 --- a/desserts/oatmeal-chocolate-chip-cookies.md +++ b/baking/oatmeal-chocolate-chip-cookies.md @@ -2,6 +2,8 @@ # Oatmeal Chocolate Chip Cookies +Oatmeal Chocolate Chip Cookies + Crispy, salty, delicious. **Author:** Christian Adams @@ -10,6 +12,8 @@ Crispy, salty, delicious. **Best Paired With:** Makes 3 dozen, 4 pans worth. +
+ ## Ingredients * 1 cup / 227 grams (2 sticks) unsalted butter, softened, more for pans diff --git a/desserts/index.md b/desserts/index.md index 3c8e648..a5d81b8 100644 --- a/desserts/index.md +++ b/desserts/index.md @@ -5,4 +5,3 @@ * [Spiced caramel pear cake](spiced-caramel-pear-cake.md) * [Crepes](./crepes.md) * [Pies](./pies.md) -* [Oatmeal Chocolate Chip Cookies](oatmeal-chocolate-chip-cookies.md) diff --git a/maintainer.md b/maintainer.md index 54b53d1..2541490 100644 --- a/maintainer.md +++ b/maintainer.md @@ -46,10 +46,10 @@ All recipe images are automatically standardized to ensure consistency across th | Setting | Default Value | |---------|---------------| -| Max Width | 800px | -| Max Height | 600px | +| Max Width | 1024px | +| Max Height | 768px | | Format | JPEG | -| Quality | 85% | +| Quality | 95% | Images smaller than the max dimensions are not upscaled. Aspect ratio is always preserved. @@ -77,10 +77,10 @@ make standardize-image IMAGE=photo.png FORMAT=WEBP QUALITY=90 |--------|-------------|---------| | `IMAGE` | Input image path (required) | - | | `OUTPUT` | Output path (optional, overwrites input if not set) | Same as input | -| `MAX_WIDTH` | Maximum width in pixels | 800 | -| `MAX_HEIGHT` | Maximum height in pixels | 600 | +| `MAX_WIDTH` | Maximum width in pixels | 1024 | +| `MAX_HEIGHT` | Maximum height in pixels | 768 | | `FORMAT` | Output format (JPEG, PNG, WEBP) | JPEG | -| `QUALITY` | Quality for lossy formats (1-100) | 85 | +| `QUALITY` | Quality for lossy formats (1-100) | 95 | ### Programmatic Usage diff --git a/recipe_automation/image_utils.py b/recipe_automation/image_utils.py index 574af63..5be2905 100644 --- a/recipe_automation/image_utils.py +++ b/recipe_automation/image_utils.py @@ -9,10 +9,10 @@ from PIL import Image # Default settings for standardized images -DEFAULT_MAX_WIDTH = 800 -DEFAULT_MAX_HEIGHT = 600 +DEFAULT_MAX_WIDTH = 1024 +DEFAULT_MAX_HEIGHT = 768 DEFAULT_FORMAT = "JPEG" -DEFAULT_QUALITY = 85 +DEFAULT_QUALITY = 95 def standardize_image( @@ -29,10 +29,10 @@ def standardize_image( Args: input_path: Path to the input image file. output_path: Path for the output image. If None, overwrites input file. - max_width: Maximum width of the output image (default: 800). - max_height: Maximum height of the output image (default: 600). + max_width: Maximum width of the output image (default: 1024). + max_height: Maximum height of the output image (default: 768). output_format: Output format (default: "JPEG"). Supports JPEG, PNG, WEBP. - quality: Output quality for lossy formats (1-100, default: 85). + quality: Output quality for lossy formats (1-100, default: 95). Returns: Path to the standardized image. @@ -52,6 +52,10 @@ def standardize_image( # Open and process the image with Image.open(input_path) as img: + # Preserve EXIF and other metadata + exif_data = img.info.get("exif") + icc_profile = img.info.get("icc_profile") + # Convert to RGB if necessary (for JPEG output) if output_format.upper() == "JPEG" and img.mode in ("RGBA", "P", "LA"): # Create a white background for transparent images @@ -65,7 +69,7 @@ def standardize_image( # Calculate new dimensions maintaining aspect ratio original_width, original_height = img.size - + # Only resize if the image is larger than the max dimensions if original_width > max_width or original_height > max_height: # Calculate the scaling factor @@ -84,7 +88,7 @@ def standardize_image( if output_dir: os.makedirs(output_dir, exist_ok=True) - # Save the image + # Save the image with preserved metadata save_kwargs = {} if output_format.upper() in ("JPEG", "WEBP"): save_kwargs["quality"] = quality @@ -92,6 +96,14 @@ def standardize_image( if output_format.upper() == "JPEG": save_kwargs["progressive"] = True + # Preserve EXIF data if available + if exif_data: + save_kwargs["exif"] = exif_data + + # Preserve ICC color profile if available + if icc_profile: + save_kwargs["icc_profile"] = icc_profile + img.save(output_path, format=output_format.upper(), **save_kwargs) return output_path diff --git a/recipe_automation/processed_recipes.json b/recipe_automation/processed_recipes.json index 3a6c94e..5ed39e6 100644 --- a/recipe_automation/processed_recipes.json +++ b/recipe_automation/processed_recipes.json @@ -1 +1 @@ -{"last_processed": "2025-11-29T23:33:18"} \ No newline at end of file +{"last_processed": "2025-12-08T23:04:34"} \ No newline at end of file diff --git a/recipe_automation/recipes.py b/recipe_automation/recipes.py index e0196e2..f816b66 100644 --- a/recipe_automation/recipes.py +++ b/recipe_automation/recipes.py @@ -206,7 +206,7 @@ def create_markdown(recipe, temp_dir=None): # Use the relative path for the markdown image_rel_path = os.path.join("images", f"{slug}.{image_ext}") - image_ref = f"![{recipe['Recipe Name']}]({image_rel_path})\n" + image_ref = f'{recipe[\n' # Add the image path to the list of files to commit if temp_dir: @@ -245,6 +245,10 @@ def create_markdown(recipe, temp_dir=None): if notes: content += f"**Best Paired With:** {notes}\n\n" + # Clear the float before ingredients section so it appears below the image + if image_ref: + content += '
\n\n' + content += f"""## Ingredients {ingredients}