Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Upscaling without premultiply and alpha channel produces black border #61

Closed
@chregu

Description

@chregu

When I do the following (upscaling an image from 300 to 400 px), i get a thin black border on top and right. When I add premultiply and unpremultiply, that border is gone. I though that's only needed when the picture has an alpha channel? Wrong assumption? Should I premultiply always? Or just when upscaling? But always when with alpha channel?

$pixel = \Jcupitt\Vips\Image::black(1, 1)->add([255 , 255, 255])->cast(BandFormat::UCHAR);
$vips = $pixel->embed(0, 0, 300, 300, ['extend' => Extend::COPY]);
$vips = $vips->copy(['interpretation' =>\Jcupitt\Vips\Interpretation::SRGB]);

//$vips = $vips->premultiply();
$vips = $vips->resize(400/$vips->width);
//$vips = $vips->unpremultiply();

$vips->jpegsave("image.jpg");

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions