Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upscaling without premultiply and alpha channel produces black border #61

Closed
chregu opened this issue Dec 6, 2017 · 3 comments
Closed
Labels

Comments

@chregu
Copy link
Contributor

chregu commented Dec 6, 2017

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");

@jcupitt
Copy link
Member

jcupitt commented Dec 6, 2017

Oh dear, looks like an unforseen consequence of the switch to centre sampling for upscale. I'll see if I can fix it.

@jcupitt jcupitt added the bug label Dec 6, 2017
jcupitt added a commit to libvips/libvips that referenced this issue Dec 7, 2017
so for upsizing with displacement (like resize) we can prevent dark
edges on bright images

see

libvips/php-vips#61
@jcupitt
Copy link
Member

jcupitt commented Dec 7, 2017

OK, seems to be fixed. Thanks for reporting this! It should be in 8.6 final.

@chregu
Copy link
Contributor Author

chregu commented Dec 7, 2017

Works for me too now, as well, thanks a lot

@chregu chregu closed this as completed Dec 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants