Comilarex Posted July 15, 2023 Share Posted July 15, 2023 Hi! I want to combine a flat colour image (png) with an alpha image (png, greyscale) into .dds. Tinkered with it for ages, tried to use other programs but to no avail. I wonder if this is possible since that would save me a lot of time. Thanks for your answer! Quote Link to comment Share on other sites More sharing options...
null54 Posted July 15, 2023 Share Posted July 15, 2023 24 minutes ago, Comilarex said: I want to combine a flat colour image (png) with an alpha image (png, greyscale) into .dds. It should be possible with @BoltBait's Apply Alpha Mask plugin using the following steps. Note that the color and alpha mask images must be the same size. Load the color image. Add the alpha image as a new layer using Layers > Import From File. Run the plugin (Object > Apply Mask) on the color layer, select alpha layer, set the mask type to Alpha and ensure the Method option is set to Replace. Delete the alpha layer. This should give you a color image with the alpha channel set from the mask image. Quote Plugin Pack | PSFilterPdn | Content Aware Fill | G'MIC | Paint Shop Pro Filetype | RAW Filetype | WebP Filetype The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait Link to comment Share on other sites More sharing options...
Comilarex Posted July 15, 2023 Author Share Posted July 15, 2023 8 hours ago, null54 said: It should be possible with @BoltBait's Apply Alpha Mask plugin using the following steps. Note that the color and alpha mask images must be the same size. Load the color image. Add the alpha image as a new layer using Layers > Import From File. Run the plugin (Object > Apply Mask) on the color layer, select alpha layer, set the mask type to Alpha and ensure the Method option is set to Replace. Delete the alpha layer. This should give you a color image with the alpha channel set from the mask image. Thanks for the answer! Sadly, it didn't had the intended effect, it basically thew all the other information away in the completely transparent areas. This is how it should look but instead, it looks like this after your described procedure: Transparent areas are off, the completly transparent areas are complely lost. Is there a way to fix that? Quote Link to comment Share on other sites More sharing options...
Solution frio Posted July 15, 2023 Solution Share Posted July 15, 2023 The Apply Alpha Mask plugin destroys color information (uses premultiplied alpha or something like that). It might be by design, but it it makes it unsuitable for purposes where that color information in transparent areas is important. You can use this instead, it's a bit more rudimentary but despite the disclaimer on the page, works just fine in modern PdN and most importantly does not damage colors in transparent areas. Quote Link to comment Share on other sites More sharing options...
Comilarex Posted July 16, 2023 Author Share Posted July 16, 2023 On 7/15/2023 at 7:05 PM, frio said: The Apply Alpha Mask plugin destroys color information (uses premultiplied alpha or something like that). It might be by design, but it it makes it unsuitable for purposes where that color information in transparent areas is important. You can use this instead, it's a bit more rudimentary but despite the disclaimer on the page, works just fine in modern PdN and most importantly does not damage colors in transparent areas. Great! This is what I wanted! Thank you! 1 Quote Link to comment Share on other sites More sharing options...
Rick Brewster Posted July 24, 2023 Share Posted July 24, 2023 On 7/15/2023 at 10:05 AM, frio said: The Apply Alpha Mask plugin destroys color information (uses premultiplied alpha or something like that) Sounds right. @BoltBait, if you want I can try to help you figure out how to do this without using premultiplied alpha (if possible). This would preserve the color channel values for transparent pixels. Quote The Paint.NET Blog: https://blog.getpaint.net/ Donations are always appreciated! https://www.getpaint.net/donate.html Link to comment Share on other sites More sharing options...
BoltBait Posted July 24, 2023 Share Posted July 24, 2023 12 minutes ago, Rick Brewster said: Sounds right. @BoltBait, if you want I can try to help you figure out how to do this without using premultiplied alpha (if possible). This would preserve the color channel values for transparent pixels. I would love that. @Rick Brewster, the code is here: https://github.com/BoltBait/ApplyMask/blob/9d49160cd84bbf5211c50c0ac5f532a13798f998/ApplyMaskEffect/ApplyMask.cs#L424 in my private repository. Quote Download: BoltBait's Plugin Pack | CodeLab | and a Free Computer Dominos Game Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.