Compare features added by other fork#6
Open
Rustymage wants to merge 20 commits into
Open
Conversation
* License Removal * License Update MIT License Added * READ.md updated Installation instructions added * READ.md Updates osx_services & font titles added * README.md Updated Font section created and updated * README.md Bullet point added * README.md Updated osx_services updated * Update README.md Link added to Robot font and removal of Avenir (licensed font) * Font Removal Removal of Avenir font as it's a paid font. * Update to README.md Link fixed * Update README.md * Resolving Comment on PR Resolving stevequinn#8 (comment) * Font Arg Parse * PR 8 Update Utilised CoPilot to add argument for font name changes * PR8 Font Validation Validate font using CoPilot help * Update to files .gitignore & READ.md update * Remove Test Image * Comments Re-added comments deleted * . * Validation Check Improvement in check * Validation Check Correction to duplication of error messages. * - Streamlines error reporting - Removes redundant code * - Adds python logging instead of print statements. --------- Co-authored-by: Steve Quinn <steve@sq.net.au>
* - Adds support for parameterised font style variants. * - Updates readme param instructions. * Logging Update Removed milli seconds and function name from logging to improve readability --------- Co-authored-by: Anthony <19926955+Rustymage@users.noreply.github.com>
This reverts commit a97fec1.
With GPT5.1
Introduces a --palette-tolerance argument to control color grouping for palette extraction. Enhances palette.py to filter near-white colors and allows dynamic tolerance, improving palette accuracy and customization.
There was a problem hiding this comment.
Pull request overview
This PR expands the photo-border CLI with more presentation controls: configurable fonts/font variants, alternate EXIF text layouts, palette filtering/tolerance, and optional Fuji film-simulation extraction/rendering. It also updates supporting docs/tests and some repository metadata.
Changes:
- Add configurable font selection/variant handling and new EXIF rendering options, including single-line/two-line layouts and Fuji film-simulation support.
- Update palette extraction to filter near-white colors and expose palette tolerance as a CLI option.
- Refresh docs/tests/repo metadata, including README usage, a new font-related test, license text, and ignore rules.
Reviewed changes
Copilot reviewed 9 out of 12 changed files in this pull request and generated 19 comments.
Show a summary per file
| File | Description |
|---|---|
text.py |
Adds font-variant discovery/validation helpers and updates font creation/sizing APIs. |
tests/test_text.py |
Adds a basic test around loading font variants. |
tests/test_exif.py |
Removes trailing blank lines only. |
tests/__init__.py |
Empty package marker; no substantive change shown. |
palette.py |
Adds near-white filtering and tolerance-aware palette extraction. |
main.py |
Extends the CLI, logging, font handling, film-sim processing, and palette placement flow. |
fonts/Avenir.ttc |
Binary font asset listed in the PR; no textual diff was available to inspect. |
exif.py |
Adds lens-name shortening and exiftool-based film-simulation extraction. |
border.py |
Refactors EXIF layout rendering and adds film-simulation icon lookup/loading. |
README.md |
Updates installation/usage/testing documentation. |
LICENSE |
Replaces the license text with MIT license content. |
.gitignore |
Expands ignored generated/media/font-related paths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+14
to
+22
| variants = [] | ||
|
|
||
| try: | ||
| font = create_font(size=12, fontpath=font_path, index=index) | ||
| except Exception: | ||
| variants = load_font_variants(fontpath=font_path) | ||
| print(f'Error loading {fontname} font variant {index}. Available variants: {variants}') | ||
| assert len(variants) is not 0 | ||
|
|
Comment on lines
+310
to
+314
| # If palette is present, adjust text position to leave room on the right | ||
| # Palette width is approximately border.bottom / 3 * number_of_colors (up to 5 colors) | ||
| # We'll reserve space for the palette on the right side | ||
| if has_palette: | ||
| palette_reserved_width = border.bottom # Approximate palette width plus padding |
|
|
||
| ## osx_services | ||
|
|
||
| Adds quick actions to you OSX menu for quick deployment of tool. |
| from enum import Enum | ||
| from dataclasses import dataclass | ||
| import glob | ||
| import numpy as np |
Comment on lines
+51
to
+54
| parser.add_argument('--oneline', action='store_true', default=False, | ||
| help='Use single-line text layout for large, polaroid, and instagram borders') | ||
| parser.add_argument('--twoline', action='store_true', default=False, | ||
| help='Use two-line left-aligned layout for large, polaroid, and instagram borders') |
Comment on lines
+22
to
+31
| while True: | ||
| try: | ||
| font = ImageFont.truetype(fontpath, size=12, index=index) | ||
| info = { | ||
| 'family': font.getname()[0], | ||
| 'style': font.getname()[1] | ||
| } | ||
| variants.append((index, info)) | ||
| index += 1 | ||
| except Exception: |
Comment on lines
25
to
+44
| ```bash | ||
| usage: python main.py [-h] [-e] [-p] [-t{s,m,l,p,i}] filename | ||
| usage: python main.py [-h] [-e] [-p] [-f] [-fb] [-t{s,m,l,p,i}] filename | ||
|
|
||
| Add a border and exif data to a jpg or png photo | ||
|
|
||
| positional arguments: | ||
| filename | ||
|
|
||
| options: | ||
| -h, --help show this help message and exit | ||
| -e, --exif print photo exif data on the border | ||
| -p, --palette Add colour palette to the photo border | ||
| -t, --border_type Border Type: p for polaroid, s for small, m for medium, l for large, i for instagram (default: s) | ||
| --include File patterns to include (default: *.jpg *.jpeg *.png, *.JPG, *.JPEG, *.PNG) | ||
| --exclude File patterns to exclude (default: *_border*) | ||
| -h, --help Show this help message and exit | ||
| -e, --exif Print photo exif data on the border | ||
| -p, --palette Add colour palette to the photo border | ||
| -t, --border_type Border Type: p for polaroid, s for small, m for medium, l for large, i for instagram (default: s) | ||
| -f, --font Font Typeface to use (default: Roboto-Regular.ttf) | ||
| -fv, --fontvariant Font style variant to use (default: 0) | ||
| -fb, --fontbold Bold Font Typeface to use (default: Roboto-Medium.ttf) | ||
| -fbv, --fontboldvariant Bold Font style variant to use (default: 0) | ||
| --include File patterns to include (default: *.jpg *.jpeg *.png, *.JPG, *.JPEG, *.PNG) | ||
| --exclude File patterns to exclude (default: *_border*) | ||
|
|
| except Exception: | ||
| variants = load_font_variants(fontpath=font_path) | ||
| print(f'Error loading {fontname} font variant {index}. Available variants: {variants}') | ||
| assert len(variants) is not 0 |
| Optional[Image.Image]: The matched film simulation image, or None if not found | ||
| """ | ||
| film_sim_images = {} | ||
| sim_image_files = glob.glob('fuji-sims/*.png') |
Comment on lines
+390
to
+404
| film_sim_images = {} | ||
| sim_image_files = glob.glob('fuji-sims/*.png') | ||
| for filepath in sim_image_files: | ||
| sim_name = os.path.splitext(os.path.basename(filepath))[0] | ||
| film_sim_images[sim_name] = Image.open(filepath) | ||
|
|
||
| # Normalize the target film sim name for matching | ||
| # Convert to lowercase and replace spaces with underscores | ||
| normalized_target = film_sim.lower().replace(' ', '_') | ||
|
|
||
| for image_key in film_sim_images: | ||
| normalized_key = image_key.lower() | ||
| # Check for exact match or substring match | ||
| if normalized_target == normalized_key or normalized_target in normalized_key: | ||
| return film_sim_images[image_key] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.