Mobile app version of vmapp.org
Login or Join
Lengel450

: Remove Alpha Channel vs Flatten Image in GIMP Does anyone know how Remove Alpha Channel works and what Flatten Image exactly does (e.g. what operations it performs and in what sequence)? In

@Lengel450

Posted in: #Flatten #Gimp #Transparency

Does anyone know how Remove Alpha Channel works and what Flatten Image exactly does (e.g. what operations it performs and in what sequence)? In particular, I'm trying to understand why they produce different results on a 1x1-px (single-layer) image with the following RGBA values for its only pixel: 78:69:128:254. Remove Alpha Channel produces a pixel with RGB values 79:70:128 while Flatten Image produces a pixel with RGB values 79:70:129. This was tested on GIMP 2.6.10 and 2.8.14. The background color specified in the toolbox was white (RGB values 255:255:255) in all tests.

EDITS


added information about the background color

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Lengel450

2 Comments

Sorted by latest first Latest Oldest Best

 

@Steve758

Definitions from the doc:


Flatten image: If there are any areas which are transparent through all of the layers of the original image, the background color is visible.. So this would be the same as adding a background layer and merging down.
Remove alpha channel: If the active layer is not the background layer, transparency is replaced with the background color of the Toolbox. Which is the description I would have used for bucket-filling in behind mode.


So, there are several operations that ought to all produce the same result:


Bucket fill white in 'Behind' mode
Merge down over white background
Pointer tool with "Sample merged" over white background
Flatten image with white background:
Flatten image without white background:
Remove alpha channel


Experimentation with 78:69:128:254:

* Bucket fill white in 'Behind' mode: 78:69:128
* Merge down over white BG: 78:69:128
* Pointer tool with "Sample merged" over white BG: 78:69:128
* Flatten image with white BG: 79:70:129
* Flatten image without white BG: 79:70:129
* Remove alpha channel: 79:70:128


The first three are consistent, #4 is surprising because it doesn't produce the same result as #2 .

Using a less extreme opacity value, experimenting with 78:69:128:200:

* Bucket fill white in 'Behind' mode: 116:109:155
* Merge down over white BG: 116:109:155
* Pointer tool with "Sample merged" over white BG: 116:109:155
* Flatten image with white BG: 116:109:155
* Flatten image without white BG: 116:109:155
* Remove alpha channel: 116:109:155


Here all give the same result.

So, there are likely slightly different methods (flattening the image could take some shortcuts) differently impacted by round off errors (yes, I know this is not an answer, but it shows some methods that always give the same result).

10% popularity Vote Up Vote Down


 

@Dunderdale640

Flatten image squashes all layers over a virtual opaque background filled with the background color, so the RBG values of the result depend on the current background color.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme