Help needed to remove shadows using ImagePathFunctions
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
- pipapopinguin
- Posts: 35
- Joined: November 3rd, 2019, 10:36 am
Help needed to remove shadows using ImagePathFunctions
I've tried to remove the shadow using this code:
and after that, if only the image had lost its shadow, i would just multiply the image to 255 alpha. problem is, that when i subtracted 30 from alpha, apperently the whole image vanished. I think I am using ADJUST_ALPHA wrong, altough im not sure.
Code: Select all
image={IMAGE}~RC(magenta>{COLOR})~ADJUST_ALPHA(formula="1 + (alpha - 30)")
- pipapopinguin
- Posts: 35
- Joined: November 3rd, 2019, 10:36 am
Re: Help needed to remove shadows using ImagePathFunctions
yes this is btw in an macro
- Celtic_Minstrel
- Developer
- Posts: 2209
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Help needed to remove shadows using ImagePathFunctions
You are using ADJUST_ALPHA wrong.
Code: Select all
image="{IMAGE}~RC(magenta>{COLOR})~ADJUST_ALPHA(1 + (alpha - 30))"
- pipapopinguin
- Posts: 35
- Joined: November 3rd, 2019, 10:36 am
Re: Help needed to remove shadows using ImagePathFunctions
Okay that helps a bit, but HOW am I using ADJUST_ALPHA wrong, am I not using right "parameters" for it or am I just not needing it for my code i want to write?Celtic_Minstrel wrote: ↑June 28th, 2021, 1:35 pm You are using ADJUST_ALPHA wrong.Code: Select all
image="{IMAGE}~RC(magenta>{COLOR})~ADJUST_ALPHA(1 + (alpha - 30))"
Re: Help needed to remove shadows using ImagePathFunctions
Isn't that the same as
alpha - 29
? Is that really what you intended?Maybe this is what you want?
Code: Select all
image="{IMAGE}~RC(magenta>{COLOR})~ADJUST_ALPHA(if(alpha = 255, 255, 0))"
- Celtic_Minstrel
- Developer
- Posts: 2209
- Joined: August 3rd, 2012, 11:26 pm
- Location: Canada
- Contact:
Re: Help needed to remove shadows using ImagePathFunctions
The error I spotted is that you wrotepipapopinguin wrote: ↑June 28th, 2021, 5:56 pm Okay that helps a bit, but HOW am I using ADJUST_ALPHA wrong, am I not using right "parameters" for it or am I just not needing it for my code i want to write?
formula="some formula"
inside ADJUST_ALPHA.This might be a syntax error if WFL sees the double quotes, in which case the formula would return null which probably becomes 0 when the game tries to convert it to a number. I think WML parses out the quotes though, which would mean that WFL sees a valid formula: comparing a null value (the variable "formula", which doesn't exist) to the result of the formula you intended. Since your intended formula returns a number, it will never be equal to null, so that formula would return false which becomes 0 when the game tries to convert it to a number.
Either way, this explains why the image disappeared – your erroneous formula set the alpha to 0 everywhere).
I don't know if the formula itself was correct, though.
- pipapopinguin
- Posts: 35
- Joined: November 3rd, 2019, 10:36 am
Re: Help needed to remove shadows using ImagePathFunctions
I can work with that, thank youCeltic_Minstrel wrote: ↑June 29th, 2021, 3:44 amThe error I spotted is that you wrotepipapopinguin wrote: ↑June 28th, 2021, 5:56 pm Okay that helps a bit, but HOW am I using ADJUST_ALPHA wrong, am I not using right "parameters" for it or am I just not needing it for my code i want to write?formula="some formula"
inside ADJUST_ALPHA.
This might be a syntax error if WFL sees the double quotes, in which case the formula would return null which probably becomes 0 when the game tries to convert it to a number. I think WML parses out the quotes though, which would mean that WFL sees a valid formula: comparing a null value (the variable "formula", which doesn't exist) to the result of the formula you intended. Since your intended formula returns a number, it will never be equal to null, so that formula would return false which becomes 0 when the game tries to convert it to a number.
Either way, this explains why the image disappeared – your erroneous formula set the alpha to 0 everywhere).
I don't know if the formula itself was correct, though.