Skip to content
    Back to all Bounties

    Earn 4,500 ($45.00)

    Time Remainingdue 2 years ago
    Completed

    Python function to render an image in a picture frame

    erik53
    erik53
    Posted 2 years ago
    This Bounty has been completed!
    @erik53's review of @HalilCanM
    4.3
    Average Rating
    Communication 4/5, Quality 5/5, Timeliness 4/5

    Bounty Description

    Problem Description

    The task is to programmatically generate a framed image with mitered corners using Python's PIL (Pillow) library. The framed image should consist of a main image (which can optionally be matted) surrounded by a frame with mitered (45-degree angle) corners. The frame can have a texture or pattern, which needs to be seamless across the edges and corners.

    Acceptance Criteria

    Frame Generation: The software should be able to generate horizontal and vertical frame strips and mitered corner pieces from a given texture or color.
    Corner Assembly: The corners should be mitered at a 45-degree angle, seamlessly joining the horizontal and vertical frame strips.
    Image Framing: The main image should be correctly positioned within the frame, with optional matting around it. The frame (with mitered corners) should be accurately aligned around this image.
    Scalability: The frame should adjust to accommodate images of various sizes while maintaining the aspect ratio and frame width.
    Output: The final output should be a single image file that combines the main image, mat (if applicable), frame strips, and mitered corners.

    Technical Details

    Image Manipulation Library: Use Python's PIL (Pillow) library for image loading, manipulation, and saving.
    Frame Strips: Create horizontal and vertical strips for the frame. If a pattern is used, it should tile seamlessly.
    Mitered Corners: Implement a function to create a mitered corner by joining the frame strips at 45 degrees. This function should handle the texture alignment at the corners.
    Image and Frame Assembly: Develop a process to assemble the matted image (if matting is applied) and frame components (strips and corners) into a final composition. Ensure that all elements are correctly aligned and sized.
    Image Handling: Include functionality to handle different image sizes and aspect ratios, adjusting the frame size accordingly.
    Error Handling: Implement error handling for scenarios such as image loading failures or incorrect image dimensions.
    Supported Frames: support the frame types White, Black, Walnut (dark wood), Maple (light wood)
    Supported Sizes: support arbitrary sizes for the frame, artwork size, and matte size
    Notes: Frame width is uniform on all size.
    Mat is always a solid color, from a provided RGB triple.

    Link to Project

    See examples at https://docs.google.com/document/d/1rKjYAD80bzY4iS6k1vvOtnwD1quyjjLJmetsO1tyrI4/edit