Jump to content

Combining Colour and Alpha Greyscale together into .dds possible?


Go to solution Solved by frio,

Recommended Posts

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!

Link to comment
Share on other sites

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.

  1. Load the color image.
  2. Add the alpha image as a new layer using Layers > Import From File.
  3. 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.
  4. Delete the alpha layer.

This should give you a color image with the alpha channel set from the mask image.

PdnSig.png

Plugin Pack | PSFilterPdn | Content Aware Fill | G'MICPaint 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

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.

  1. Load the color image.
  2. Add the alpha image as a new layer using Layers > Import From File.
  3. 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.
  4. 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.
2023-07-1512_41_25-_barbaraBodyLightMap.dds-paint_net5.0.7.png.a1bbc8b156217cf331df5b0cde53b42f.png2023-07-1512_43_10-_barbaraBodyLightMap.dds-paint_net5.0.7.png.0cf9ea548915f6358d577ea81ef3ed9c.png
This is how it should look but instead, it looks like this after your described procedure:
2023-07-1512_42_07-_1.png-paint_net5.0.7.png.7e41cd508cc3044e57d618a5c0141e53.png2023-07-1512_42_57-_1.png-paint_net5.0.7.png.0ad93b556ac36fb82039d53b0ee7dfc3.png
Transparent areas are off, the completly transparent areas are complely lost.

 

Is there a way to fix that?

Link to comment
Share on other sites

  • Solution

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.

 

 

Link to comment
Share on other sites

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!

  • Thanks 1
Link to comment
Share on other sites

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.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...