-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Enhancement: allow ensureAlpha to set the alpha transparency level #2634
Comments
Hello, the Point filter in ImageMagick uses nearest-neighbour interpolation so try the The This doesn't quite do what you need, but it would be a nice addition to sharp for Here's how the API to do this might look: // PROPOSED API, NOT YET AVAILABLE
sharp(input).ensureAlpha(1)... // fully-transparent |
v0.28.1 allows the alpha transparency level to be set via |
The docs say:
So |
@mattpr You can chain |
I'm re-writing an older .NET program that uses ImageMagick and need help mapping image operations. I'm also not very familiar with image processing so bear with me :) Using Node.js and the npm Sharp package.
The program has multiple conversion paths/outputs per input image and Sharp is working great except for one path where the ImageMagick output looks different from the Sharp output. The IM image is fully transparent and the Sharp image has visible areas. I suspect it's related to alpha and transparency.
Below is a sample of the old code. I'm not sure about the FilterType (kernel?) and the transparent option. I also attached examples of an input image and outputs from IM and Sharp. Any help you can provide would be great. Thank you!
MagickImage image = new MagickImage('input.png');
image.FilterType = FilterType.Point;
image.Scale(2500, 2500);
image.Alpha(AlphaOption.Transparent);
image.ColorType = ColorType.TrueColorAlpha;
image.Format = MagickFormat.Png64;
…process/save image
I've gotten this far...
sharp(“test.png”)
.resize({
height: 2500,
width: 2500,
kernel: ?,
})
.toColorspace('rgb16')
.toFile(“output.png”)
Input
ImageMagick output
Sharp output
The text was updated successfully, but these errors were encountered: