Page 1 of 1
Savebrush PNG Alpha doesn't work!
Posted: Mon Sep 19, 2011 11:36 pm
by fingus
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.
Re: Savebrush PNG Alpha doesn't work!
Posted: Fri Sep 23, 2011 5:13 pm
by airsoftsoftwair
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!
Posted: Fri Sep 23, 2011 9:54 pm
by fingus
I can't reproduce this problem. Please provide a fully working (but small!) code snippet. Then I can see what's wrong there.
Ok, do this:
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

Re: Savebrush PNG Alpha doesn't work!
Posted: Sun Sep 25, 2011 10:29 pm
by airsoftsoftwair
Hmm, where is the n_sunny.png image? I can't see it in your post!?
Re: Savebrush PNG Alpha doesn't work!
Posted: Mon Sep 26, 2011 9:58 am
by fingus
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.
Re: Savebrush PNG Alpha doesn't work!
Posted: Mon Sep 26, 2011 1:48 pm
by airsoftsoftwair
Please read the documentation of SaveBrush(). You're using it in the wrong way. The correct syntax would be:
Code: Select all
SaveBrush(2, "ram:ico.png", 0, #IMGFMT_PNG)
Then it will work fine.