-
Notifications
You must be signed in to change notification settings - Fork 616
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
How to specify extent background color? #415
Comments
Have you solved this problem ? Now I am confusing with this. |
I have no idea how to solve this. The problem is when I convert a PNG with a transparent background to a JPG. The script fills in the transparent background with black by default. I can't figure out how to specify a different background color. |
I use the GM with C++. As you said, finally I put the png on the top of another canvas with needed color. I use the composite function. And this sovled this problem. |
In the GM, there exit two functions, backgroundColor(Color) and matteColor(Color), I have tried both, but no help. |
I've been struggling with this too. Finally realised you have to "flatten" the png
|
But there is no flatten() function in GM's C++ usage. |
FlattenImage() maybe? |
Aha. This function is what I need. When I do this to a png image, I got a jpg file with white background color: |
So how do you do this with this |
gm("img.png").background('#FF0000').flatten().toFormat('jpg'); |
Hey, @rwky only flatten is documented on http://aheckmann.github.io/gm/docs.html |
@mikemonteith toFormat method is not defined:
|
@digz6666 I'm not sure where I got |
According to the docs, extent's description is:
The usage is:
How do you use this function? Where do you specify the background color of the image.
The problem I'm trying to solve is converting a PNG (with transparency) to a JPG. By default, the transparent color gets filled with black. I'm trying to figure out how to fill it with a different color and I'm assuming I need to composite the image on top of another blank color canvas before saving the output image.
The text was updated successfully, but these errors were encountered: