-
-
Notifications
You must be signed in to change notification settings - Fork 773
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
Replace transparency with a colour #316
Comments
Would be nice to be able to declare the background color as an option. |
You can set a "default color" in Jimp. Let me look into that... EDIT: try this: I don't have my normal computer, so can't test :( |
Any news on this? |
Hi @Ojas-Gulati, Yes that works. The full code snippet is as follows. Note that I added // var inputBuffer = (Blob or read image from file)
Jimp.read(inputBuffer, function (err, image) {
if (err) throw err;
image
.rgba(false)
.background(0xFFFFFFFF)
.getBuffer(Jimp.MIME_PNG, function (err, outputBuffer) {
// the image output here will have white background
});
}); |
Closing issue, thanks all. |
Hi, I tried this method to convert a png with transparent background to a jpeg with white background:
However, it turns the background into cyan. |
@andrekisi maybe https://www.npmjs.com/package/replace-color can solve your problem |
You can achieve this with compositing...
|
Thanks for this <3 |
Hi,
I'm currently converting PNG (&/BMP/GIF) to JPG. When I convert images, any transparency (alpha channels) turn BLACK. I would like to change this to WHITE.
Is there a way to do this out of the box?
1. Apply image on top of a white background
2. Manually alter each pixel
Sample Source Images
SourceImages.zip
The text was updated successfully, but these errors were encountered: