Jump to content
You must now use your email address to sign in [click for more info] ×

How to Edit the Alpha Channel


Recommended Posts

I wasn't meaning to imply those features were unimportant - they are important for me too. I'm mainly working in 3D CGI - so 32bit renders, ACES and EXR are one of the main reasons I got AP in the first place.  It just seems very odd to me that they claim their target market to be 'photographers and photo editing', but do support advanced features and functionality such as 32b, ACES, EXR - and yet don't support basic features like direct and unrestricted alpha manipulation. Bizzare.

Link to comment
Share on other sites

20 hours ago, Mike_A said:

I wasn't meaning to imply those features were unimportant - they are important for me too. I'm mainly working in 3D CGI - so 32bit renders, ACES and EXR are one of the main reasons I got AP in the first place.  It just seems very odd to me that they claim their target market to be 'photographers and photo editing', but do support advanced features and functionality such as 32b, ACES, EXR - and yet don't support basic features like direct and unrestricted alpha manipulation. Bizzare.

Completely agree.

Link to comment
Share on other sites

I would like to buy the whole V2 suite.

But I need to be able to copy a channel of an image to the alpha channel of the same image.

I should be able to edit the alpha channel as well as the RGB channels.

Of course I should be able to load an RGBA image, edit the alpha channel and save it as an RGBA image without changing the RGB values (straight alpha).

Link to comment
Share on other sites

On 11/11/2022 at 12:35 PM, MattyWS said:

their answer is always something like "this is a photo editing software for photographers"

… unless the answer is different :234_unicorn:

Especially when Publisher gets used for motion picture production

521461496_helpOCIOmotionvideo.thumb.jpg.bda5e1a6c9c8677ebad6068c2e721153.jpg

… whereas for instance "Layer States" seem to be a workflow exclusively useful for photographers. 😇

macOS 10.14.6 | MacBookPro Retina 15" | Eizo 27" | Affinity V1

Link to comment
Share on other sites

1 minute ago, tbelgrave said:

Btw not sure if this was mentioned earlier in this thread, you can use the free PhotoPea to accomplish this, especially if you don't want to get fleeced from Adobe.

Thank you. Actually the most people knows an alternative where this can be done, even in open source apps.
The point is: we need it in Affinity Photo and it should be possible in such a tool in my opinion.

Link to comment
Share on other sites

I bought Affinity Photo 2 upgrade because I want to support the development, Affinity is doing a lot of things right for HDR manipulation and I love the software.
But I'm sad to see no changes concerning the Alpha Channel editing... I'm not even asking to be able to paint it, just extract it from a layer would be enough. We need to be able to author alphas to export 4-channels TGAs into Unreal.

It's the only reason I can't fully switch to Affinity Photo, and I really hope Serif is looking into it.

Link to comment
Share on other sites

  • 2 weeks later...

This is an interesting problem. Probably one that is impossible to be properly fixed. Affinity Photo, same as Photoshop and others, has unassociated alpha internals. So it has to multiply and divide RGB by alpha lots of times during processing, depending on which tool is applied to the image.
That's a design burden that comes with a price.

An example? Try opening an associated alpha EXR in Photoshop... Now see how it screwed your transparent emissions.

A lot of people got used to alpha as a mask. The "unassociated" state of the alpha channel. The one that has to be multiplied by the alpha-over operation.
So the game industry, assuming this is the natural state of an alpha encoded image, started to use channels for things that RGBA images were never intended for (like encoding textures for PBR shaders, for instance).

But if you take a look at the history of digital imaging, it becomes quite clear that alpha channel was created as a means to represent occlusion, where RGB was always represented emission. With that in mind, the alpha as a mask (unassociated, key, straight or whatever you call it) is just a temporary state. When the image with the mask has to be composited over a background, the alpha channel must be multiplied in order to get rid of the undesired emissions.

You can produce a correct associated-alpha image from an unassociated one, but not the other way around, because an associated image (a CG render, for instance) might have emissive and transparent pixels that are impossible to be expressed as unassociated alpha.
 

So, if Serif wanted to please the VFX guys, moving to an architecture that aims to keep alpha association minimizing the need of predivision would be the way to go.

But the apps must also work for the DTP people, who are more likely to be fine with the things the way they are now.

And then there are also people from the gaming industry, who need some specific hacks to work too, like channel packing.

Nobody managed so far to produce a software package that does it right for everyone. Digital compositing apps like Nuke or Fusion have the tools for dealing with this stuff, but with the cost of extra complexity (you really need to track your alpha association down your compositing tree and know what you're doing, and there are still operations that require a potentially destructive division, like some color grading operations).

It may seem that Photoshop, or Photopea, or whatever app you want to name does it right when it comes to achieve a specific goal, but none of them has all the fronts covered. It's just not possible because it's a mess: every format has its own specs for alpha, and then programs seem to "prefer" one or the other alpha format.

This seems a matter of expectations, as there isn't an unique solution that makes it right for everyone. Or at least nobody seems to have found it yet, so it's probably unfair to ask for it as it was an easy fix.

 

Link to comment
Share on other sites

6 hours ago, Guillermo Espertino said:

This is an interesting problem. Probably one that is impossible to be properly fixed. Affinity Photo, same as Photoshop and others, has unassociated alpha internals. So it has to multiply and divide RGB by alpha lots of times during processing, depending on which tool is applied to the image.
That's a design burden that comes with a price.

An example? Try opening an associated alpha EXR in Photoshop... Now see how it screwed your transparent emissions.

A lot of people got used to alpha as a mask. The "unassociated" state of the alpha channel. The one that has to be multiplied by the alpha-over operation.
So the game industry, assuming this is the natural state of an alpha encoded image, started to use channels for things that RGBA images were never intended for (like encoding textures for PBR shaders, for instance).

But if you take a look at the history of digital imaging, it becomes quite clear that alpha channel was created as a means to represent occlusion, where RGB was always represented emission. With that in mind, the alpha as a mask (unassociated, key, straight or whatever you call it) is just a temporary state. When the image with the mask has to be composited over a background, the alpha channel must be multiplied in order to get rid of the undesired emissions.

You can produce a correct associated-alpha image from an unassociated one, but not the other way around, because an associated image (a CG render, for instance) might have emissive and transparent pixels that are impossible to be expressed as unassociated alpha.
 

So, if Serif wanted to please the VFX guys, moving to an architecture that aims to keep alpha association minimizing the need of predivision would be the way to go.

But the apps must also work for the DTP people, who are more likely to be fine with the things the way they are now.

And then there are also people from the gaming industry, who need some specific hacks to work too, like channel packing.

Nobody managed so far to produce a software package that does it right for everyone. Digital compositing apps like Nuke or Fusion have the tools for dealing with this stuff, but with the cost of extra complexity (you really need to track your alpha association down your compositing tree and know what you're doing, and there are still operations that require a potentially destructive division, like some color grading operations).

It may seem that Photoshop, or Photopea, or whatever app you want to name does it right when it comes to achieve a specific goal, but none of them has all the fronts covered. It's just not possible because it's a mess: every format has its own specs for alpha, and then programs seem to "prefer" one or the other alpha format.

This seems a matter of expectations, as there isn't an unique solution that makes it right for everyone. Or at least nobody seems to have found it yet, so it's probably unfair to ask for it as it was an easy fix.

 

All right, but it would be as simple to let the users choose these aspects:

  1. Deactivate automatic delete RGB (set to 0) when alpha gets 0 while editing or exporting
  2. allow the alpha channel to be treated as regular color channel during edits (another mode like isolation/solo mode, but global for all layers)
  3. allow copy / paste between RGB and A channel (instead of lengthy spare channel method)
  4. manually override the automatic premultiplied / not premultiplied conversion during import / export. Internally, Affinity always uses a separate A channel, for every color format, for every imported image.

Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

 

Link to comment
Share on other sites

7 hours ago, NotMyFault said:

All right, but it would be as simple to let the users choose these aspects:

  1. Deactivate automatic delete RGB (set to 0) when alpha gets 0 while editing or exporting
  2. allow the alpha channel to be treated as regular color channel during edits (another mode like isolation/solo mode, but global for all layers)
  3. allow copy / paste between RGB and A channel (instead of lengthy spare channel method)
  4. manually override the automatic premultiplied / not premultiplied conversion during import / export. Internally, Affinity always uses a separate A channel, for every color format, for every imported image.

1. Is there really an automatic deletion of RGB set to 0, or is it alpha association (multiplication) taking place and then reversed for unassociated alpha formats? You can't tell as the code is not available.

2. It's not that simple. When you apply convolutions (such as gaussian blur) or even transforms like rotation or scale, the image has to be associated. Keeping the alpha channel as a separate mask might introduce artifacts or undesired color bleeds.

3. That could be useful to produce an unassociated alpha image manually, yes. There's room for improvement in the channels handling in Affinity Photo, that's for sure.

4. The override for the import is already there in the prefs, and the options are quite complete. Export is tricky. Introducing that feature would allow users to do what you need, but also to produce files that are not compliant with the output fileformat specs.

Link to comment
Share on other sites

1 hour ago, Guillermo Espertino said:

1. Is there really an automatic deletion of RGB set to 0, or is it alpha association (multiplication) taking place and then reversed for unassociated alpha formats? You can't tell as the code is not available.

yes, RGB are set to 0. This does not happen if you move the alpha channel into a separate mask layer and fill the pixel layer alpha channel with 1. This has been explained by another user as workaround.

1 hour ago, Guillermo Espertino said:

2. It's not that simple. When you apply convolutions (such as gaussian blur) or even transforms like rotation or scale, the image has to be associated. Keeping the alpha channel as a separate mask might introduce artifacts or undesired color bleeds.

no. For all layer blend operation, the alpha channel gets factored (all, from pixel layers, masks, etc). in. So every layer adjustment / filter / blend operation automatically does the "association". A pixel layer with a separate mask layer is treated identical to a pixel layer using the inherent alpha channel - there are only exceptions with  (unfortunately lots of) unsolved bugs where nested layers using alpha channel are involved. I don't use separate alpha for pixel layers often, so I might have overlooked some edge cases. 

 

 

1 hour ago, Guillermo Espertino said:

4. The override for the import is already there in the prefs, and the options are quite complete. Export is tricky. Introducing that feature would allow users to do what you need, but also to produce files that are not compliant with the output fileformat specs.

But only for EXR files. I may have misunderstood this, but game developers are often use TGA and other formats and complain about how alpha is treated during import and export.

 

Mac mini M1 A2348 | Windows 10 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

 

Link to comment
Share on other sites

On 11/26/2022 at 1:54 PM, NotMyFault said:

yes, RGB are set to 0. This does not happen if you move the alpha channel into a separate mask layer and fill the pixel layer alpha channel with 1. This has been explained by another user as workaround.

Maybe I wasn't clear. I meant that Affinity may be multiplying the alpha channel in the projection buffer, so the RGBA output of the final composite is associated. That would mean in practice that every transparent pixel got multiplied by 0 where alpha is 0, resulting in a pixel that is 0,0,0. And that would also mean that, for unassociated output formats as PNG, a division has to be performed to recover the solid color values from the semi-transparent pixels, but what's 0 remains at 0 since you can't divide by zero.
We can't know what the code is doing because it's not available, so anybody who is not a part of the Serif stuff may make an educated guess, but that's it.

Now, if I am right and that's the case, we don't know the reasons for that. I'm going to guess again: Maybe the reason behind that decision is performance, because you have to display the result of your composite at variable zoom levels and the filtering required for scaling the whole projection of your compositing with transparency REQUIRES associated alpha (that's a fact)

At any rate, It's probably not a simple thing to fix. It's not that they just have to stop replacing transparent RGB with zeros. The whole pipeline might be tied to the alpha state of the composite and doing something else could potentially mean redesigning the whole pipe.

On the other hand, the workaround cited makes sense with the desired result: If you want to use alpha AS A MASK, then it means that alpha isn't tied to RGB. Alpha as a mask is a temporary state. If you look at the alpha-over operation, it's clear that unassociated alpha has to be pre-multiplied since it's not ready to be composited.
This is crucial: The alpha over operation is different for associated and unasociated images, because unassociated images need to be associated to be composited properly!

So, with that in mind, it sort of makes sense that if you want to keep your RGB without transparency and your alpha as a mask, use an RGB image without transparency and a separate mask instead.
It's not really a workaround, but the way that users should expect it to act. RGBA transparency is *always* associated.

That being said, it's true that channels in affinity apps are somewhat inaccessible. Maybe some UI tweaks allowing more direct manipulations of channels is all we need.

Link to comment
Share on other sites

Are there apps that can import/edit/export alpha channel properly other than Photoshop currently? (Except expensive high-end apps)
The apps I know are only Corel Painter/PhotoPaint.
Others are incomplete.
e.g. Gimp can import/export but can not edit alpha directly and needs to convert the alpha into a mask to edit.

Link to comment
Share on other sites

On 11/29/2022 at 2:13 AM, ashf said:

Are there apps that can import/edit/export alpha channel properly other than Photoshop currently? (Except expensive high-end apps)
The apps I know are only Corel Painter/PhotoPaint.
Others are incomplete.
e.g. Gimp can import/export but can not edit alpha directly and needs to convert the alpha into a mask to edit.

Every program mentioned above has issues when dealing with alpha. Even Photoshop.
Photoshop does a decent job with formats that use unassociated alpha, but it sucks when it comes to images with associated alpha (like EXR).
You need a plugin to keep Photoshop from destroying proper associated images.

GIMP the last time I checked did pretty much the same as Photoshop (i.e. everything is mostly fine if your workflow involves unassociated alpha), and the channels were relatively useful. The alpha channel is editable when it is a mask and it lets you paint directly to channels without affecting the alpha (the mask), so it can be used for packing textures as channels. Exports TGA with separate mask without premultiplying too.

Krita is a decent painting program, but it's super slow and its image manipulation capabilities are quite limited, and its channels panel is close to useless.

Personally I think that Affinity Photo is pretty much ok, but it seems to associate RGBA images upon import. There are prefs for OpenEXR, but TGAs and PNGs are out of luck. I don't understand why people say they can't save unassociated TGAs, though. I tried and it's possible.

At any rate, I think that offering the same options available for OpenEXR alpha for the rest of the formats would improve the situation substantially.

Link to comment
Share on other sites

On 11/30/2022 at 8:35 PM, Guillermo Espertino said:

Every program mentioned above has issues when dealing with alpha. Even Photoshop.
Photoshop does a decent job with formats that use unassociated alpha, but it sucks when it comes to images with associated alpha (like EXR).
You need a plugin to keep Photoshop from destroying proper associated images.

GIMP the last time I checked did pretty much the same as Photoshop (i.e. everything is mostly fine if your workflow involves unassociated alpha), and the channels were relatively useful. The alpha channel is editable when it is a mask and it lets you paint directly to channels without affecting the alpha (the mask), so it can be used for packing textures as channels. Exports TGA with separate mask without premultiplying too.

Krita is a decent painting program, but it's super slow and its image manipulation capabilities are quite limited, and its channels panel is close to useless.

Personally I think that Affinity Photo is pretty much ok, but it seems to associate RGBA images upon import. There are prefs for OpenEXR, but TGAs and PNGs are out of luck. I don't understand why people say they can't save unassociated TGAs, though. I tried and it's possible.

At any rate, I think that offering the same options available for OpenEXR alpha for the rest of the formats would improve the situation substantially.

https://www.photopea.com is free on the web and pretty much is Affinity photo

Link to comment
Share on other sites

On 12/7/2022 at 7:32 AM, BrunoMartelli said:

https://www.photopea.com is free on the web and pretty much is Affinity photo

Photopea is quite impressive for a free web app, but it's a bit silly to compare it to Affinity Photo. 
It's just an 8-bit sRGB image manipulation software, it fails to do proper associated alpha and it bakes high dynamic range destructively into a clipped 8-bit sRGB image.
For a serious imager it's just a toy.

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.
Note: Your post will require moderator approval before it will be visible.

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.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.