CopyBrush(iconnr, 1000)
trimbrush(1000)
ScaleBrush(1000,40,#KEEPASPRAT)
SaveBrush(1000, "ram:T/ico.png", IMGFMT_PNG)
gives me this:
Alpha is missing!
source was this:
And how this SMOOTH=TRUE tag is using in ScaleBrush(1000,40,#KEEPASPRAT)?
I tried it like in the Online-Help mentioned by ScaleBrush(1000,40,#KEEPASPRAT,{SMOOTH=true}) but does not work.
Savebrush PNG Alpha doesn't work!
- airsoftsoftwair
- Posts: 5446
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Savebrush PNG Alpha doesn't work!
I can't reproduce this problem. Please provide a fully working (but small!) code snippet. Then I can see what's wrong there.
Re: Savebrush PNG Alpha doesn't work!
Ok, do this:I can't reproduce this problem. Please provide a fully working (but small!) code snippet. Then I can see what's wrong there.
1. Save the second PNG-Image from my first post named "n_sunny.png" and save it to ram:
2. Copy and execute this code:
Code: Select all
@BRUSH 1,"ram:n_sunny.png", {loadalpha = True}
CopyBrush(1, 2)
trimbrush(2)
ScaleBrush(2,40,#KEEPASPRAT)
SaveBrush(2, "ram:ico.png", IMGFMT_PNG)
It will save a trimmed and resized icon to ico.png, but the borders are not filled with alpha-tranceparency anymore but with garbarge!
Here you can see the result without trim and resize after saving to png:
Alpha is missing (white canvas) and garbarge around the object was added
- airsoftsoftwair
- Posts: 5446
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Savebrush PNG Alpha doesn't work!
Hmm, where is the n_sunny.png image? I can't see it in your post!?
Re: Savebrush PNG Alpha doesn't work!
oups, my fault!
here are the images again:
original with alpha working:
scaled and trimmed one with missing alpha (savebrush, see above):
and the same in original size:
As you can see, something went wrong with the alpha saving.
here are the images again:
original with alpha working:
scaled and trimmed one with missing alpha (savebrush, see above):
and the same in original size:
As you can see, something went wrong with the alpha saving.
- airsoftsoftwair
- Posts: 5446
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Savebrush PNG Alpha doesn't work!
Please read the documentation of SaveBrush(). You're using it in the wrong way. The correct syntax would be:
Then it will work fine.
Code: Select all
SaveBrush(2, "ram:ico.png", 0, #IMGFMT_PNG)