def METHOD_NAME(cls, name, image_path, config_path, force_autotrim=None, default_autotrim=True):
    config = keyval.parse(config_path, missing_ok=True)
    image = PIL.Image.open(image_path)
    alphamap_path = find_alphamap(image_path)
    if alphamap_path is not None:
        tmp = PIL.Image.open(alphamap_path)
        alphamap_image, *_ = tmp.split()  # Extract red channel
        tmp.close()
    else:
        alphamap_image = None
    sprite = cls(
        name=name,
        image=image,
        alphamap_image=alphamap_image,
        padding=Padding.from_config(config),
        config=config,
    )
    if force_autotrim is not None:
        autotrim = force_autotrim
    else:
        autotrim = keyval.strbool(config.get('autotrim', default_autotrim))
    if autotrim:
        sprite.trim()
    return sprite