CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-imutils

A series of convenience functions to make basic image processing functions such as translation, rotation, resizing, skeletonization, displaying Matplotlib images, sorting contours, detecting edges, and much more easier with OpenCV and both Python 2.7 and Python 3.

91

1.33x
Overview
Eval results
Files

task.mdevals/scenario-2/

Image Enhancement Tool

Build an image enhancement tool that allows users to improve the visual quality of their images by adjusting brightness and contrast levels.

Requirements

The tool should:

  • Load an image from a file path
  • Accept brightness and contrast adjustment parameters
  • Apply the brightness and contrast adjustments to the image
  • Save the enhanced image to an output file path

The brightness parameter should support both positive values (to brighten) and negative values (to darken), with 0 meaning no change. The contrast parameter should also support positive and negative values, with 0 meaning no change.

@generates

API

def enhance_image(input_path: str, output_path: str, brightness: float = 0.0, contrast: float = 0.0) -> None:
    """
    Enhances an image by adjusting its brightness and contrast.

    Args:
        input_path: Path to the input image file
        output_path: Path where the enhanced image will be saved
        brightness: Brightness adjustment value (0 = no change, positive = brighter, negative = darker)
        contrast: Contrast adjustment value (0 = no change, positive = more contrast, negative = less contrast)
    """
    pass

Test Cases

  • Loading a color image (RGB) and adjusting brightness to +50 makes the image visibly brighter @test
  • Loading a color image and adjusting contrast to +30 increases the visual contrast @test
  • Loading an image and adjusting both brightness to -20 and contrast to +15 applies both adjustments correctly @test
  • Passing brightness value of 0 and contrast value of 0 results in an output image identical to the input @test

Dependencies { .dependencies }

imutils { .dependency }

Provides image processing convenience functions for adjusting brightness and contrast.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/pypi-imutils

tile.json