[WIP] Fix exif text overlap with color palette in border#2
Merged
Conversation
Copilot stopped work on behalf of
Rustymage due to an error
May 1, 2026 21:11
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.
max_widthparameter todraw_exifinborder.pyto shrink fonts when text would overlap the palettemain.pyto calculate palette position/size before callingdraw_exif, computeexif_max_width, and pass it todraw_exifOriginal prompt
Problem
When using
--border_type m(medium) with both--exifand--paletteflags, the exif data text is drawn over the color palette instead of shrinking to fit the available space.Root cause:
draw_exifinborder.pydraws text horizontally (left-to-right) for non-centered border types (small, medium).draw_exifhas no knowledge of how much horizontal space the palette occupies.Fix
1.
border.py— Addmax_widthparameter todraw_exifAdd an optional
max_widthparameter todraw_exif. When provided (and the layout is non-centered), iteratively reduce the font sizes until all exif text lines fit withinmax_width.2.
main.py— Calculate palette width before callingdraw_exif, passmax_widthexif_max_width = palette_x - border.left(the horizontal space available for text).max_width=exif_max_widthintodraw_exif.overlay_palettecall after exif drawing (order of image compositing unchanged).Files to change
border.py—draw_exiffunctionmain.py—process_imagefunctionThe following is the prior conversation context from the user's chat exploration (may be truncated):
User: when using the environment variable medium with exif data and color palette, sometimes the exif data prints over the color palette rather than shrinking further.
Assistant: Now I have a clear picture of the bug. Here's the root cause and fix:
Root Cause
When using
--border_type m(medium) with both--exifand--palette:draw_exifdraws text horizontally (left-to-right) starting atx = border.left, becausemediumis not in thecenteredlist (POLAROID,LARGE,INSTAGRAM). The font multiplier is0.5ofborder.bottom— larger than for centered layouts.load_image_color_palette+overlay_palettethen places a color palette in the bottom-right of the border.The exif drawing code in
border.py(draw_exif) has nomax_widthconstraint, and t...This pull request was created from Copilot chat.