How to create a transparent image
See original GitHub issueHello,
I’m trying to create a blank transparent Jimp image, but it always has a color value. I tried using the opacity method, but it doesn’t seem to work.
Here is my code:
var mainImage = new Jimp(caseWidth, caseHeight, function (err, image) {
image.opacity(0, function(err, image) {
image.write(caseImage);
});
});
It creates the new image, but it is all black and will not become transparent. I have tried using both the mainImage and reading the caseImage again, but they are both all black.
Is there something I am missing?
Thanks.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
Free Transparent Background Maker | Adobe Express
Create images with transparent backgrounds for free with Adobe Express. Make your image transparent by removing the background in one click to create...
Read more >Make an Image Background Transparent - Free Online Tool
Automatically remove background of any image and make it transparent. Upload your photo now & see the magic.
Read more >9 Quick Ways to Make an Image Transparent on Windows and ...
9 Quick Ways to Make an Image Transparent on Windows and Mac · Next, select Open > Browse files to open your image....
Read more >How to Make a Transparent Background - 5 Ways to Remove ...
Step 1. Open Logo File · Step 2. Add A Transparent Layer · Step 3. Delete the background · Step 4. Save As...
Read more >How to Make an Image Background Transparent - MakeUseOf
In the Picture Format menu, there is a button called Remove Background. When you click it, the software will identify what it perceives...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Turns out you can’t have a transparent jpg… Thanks!
You can add an optional background color argument to the Jimp constructor:
(
0x0 = 0 = rgba(0, 0, 0, 0)
)