FFitLumen
AI coding workspace

Aspect-fit pixel boxes

A centered image still has to fit the available pixels. FitLumen gives dimension calculations and rounding examples a place in your Windows project conversation, with changes you can inspect before applying.

● ● ●FitLumen●
A concrete starting point · Aspect-fit pixel boxes ×
def fit_box(image_width, image_height, box_width, box_height):
    values = (image_width,image_height,box_width,box_height)
    if any(type(v) is not int or not 1 <= v <= 1000000 for v in values):
        raise ValueError("dimensions 1 through 1000000")
    if image_width*box_height > image_height*box_width:
        width, height = box_width, image_height*box_width//image_width
    else:
        width, height = image_width*box_height//image_height, box_height
    if not width or not height: raise ValueError("subpixel result")
    return (box_width-width)//2, (box_height-height)//2, width, height
✳Fit an image into a pixel box using integer dimensions from 1 through 1000000.
✓ ChangesReview before applying ↗
Illustrative workspace
  1. Project

    Test portrait, landscape and odd padding, rejecting a subpixel result and rounding the scaled size down before centering.

  2. Review before applying

    Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.

  3. Connection

    Base URL, credentials and a reachable server.

Workflows

Aspect-fit pixel boxes

Workflows ↗
A concrete starting point
def fit_box(image_width, image_height, box_width, box_height):
    values = (image_width,image_height,box_width,box_height)
    if any(type(v) is not int or not 1 <= v <= 1000000 for v in values):
        raise ValueError("dimensions 1 through 1000000")
    if image_width*box_height > image_height*box_width:
        width, height = box_width, image_height*box_width//image_width
    else:
        width, height = image_width*box_height//image_height, box_height
    if not width or not height: raise ValueError("subpixel result")
    return (box_width-width)//2, (box_height-height)//2, width, height
AI coding workspace

Review image sizing as part of the whole screen

FitLumen is a Windows coding workspace for working through layout-related software changes with a connected AI model. Start with the project folder and describe the image placement that looks wrong. Ask for the relevant calculation and rendering code to be inspected together, so the proposed edit reflects both the dimensions produced and the way the application uses them.

The fit_box.py example can anchor a task about preserving an image's aspect ratio inside a bounded area. Give the assistant representative source sizes, destination sizes and the expected treatment of unused space. Then ask how rounding and very small results affect the caller. This is a project investigation you can pursue in the workspace, with the example providing a concrete starting point rather than an included image-processing service.

Unrestricted AI model choice is available through supported OpenAI-compatible or Anthropic endpoints that offer such models. Configure the connection and its required credentials, taking account of the server's tools and context capacity. Review proposed edits, test portrait and landscape cases and inspect the application output. A valid size calculation is only part of success: the surrounding layout must interpret the offsets and dimensions consistently for the result to match your intended screen.

Checking an image-sizing change

What dimensions should accompany a layout bug?

Provide the source image dimensions, available box size and actual rendered placement. State whether the goal is to fit the entire image or fill the area by cropping. Those are different requirements and should not be inferred from a vague request.

Why inspect offsets as well as width and height?

The image can have the correct size yet appear misplaced if the caller interprets its position differently. Review the coordinate origin and centering expectations together. Include a nonsquare example so unused space appears along a clearly identifiable axis.

What if rounding produces a zero-sized result?

Specify whether the application rejects that case or uses another representation. Inspect how the caller responds before changing the helper. Silent adjustment may produce unexpected distortion, while an unhandled rejection may leave the screen without useful feedback.

Can numerical tests replace looking at the layout?

They verify calculation behavior but not every rendering assumption. Run the relevant tests and inspect representative screens. Padding, scaling or a caller applying dimensions twice can still create a visible defect outside the helper's own calculations.

Get the Windows app ↗

FitLumen · Updated 2026-10-25