# RGBA -\> RGB default background color vs padding color

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Frgba-rgb-default-background-color-vs-padding-color%2F157320%3E%5C
**Category:** 🤗Transformers\
**Created:** [May 30, 2025, 1:39am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Frgba-rgb-default-background-color-vs-padding-color%2F157320 "2025-05-30T01:39:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rdong8groq](https://avatars.discourse-cdn.com/v4/letter/r/eb9ed0/32.png) [@rdong8groq](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Frdong8groq)%5C
**Post date:** [May 30, 2025, 1:39am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Frgba-rgb-default-background-color-vs-padding-color%2F157320%2F1 "2025-05-30T01:39:03Z")

</div>

Most image processors will convert RGBA images to RGB by somehow incorporating the alpha channel. With Pixtral, they [use the alpha channel as weight for the RGB channels on a white background](https://github.com/huggingface/transformers/blob/main/src/transformers/models/pixtral/image_processing_pixtral.py#L72), ie. if you pass in an RGBA image, the “transparent” part ends up white.

However, the Pixtral image processor also uses the default pad function from the `image_transforms.py` file, which by default will [pad with black pixels](https://github.com/huggingface/transformers/blob/main/src/transformers/image_transforms.py#L697).

Doesn’t this mean you could end up with an image that has a white background with a black padded border? It doesn’t really seem right but I want to know if it is intentional.

---

<div class="post-metadata">

**Author:** ![John6666](https://sea2.discourse-cdn.com/hellohellohello/user_avatar/discuss.huggingface.co/john6666/32/27664_2.png) [@John6666](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2FJohn6666)%5C
**Post date:** [May 30, 2025, 3:17am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Frgba-rgb-default-background-color-vs-padding-color%2F157320%2F2 "2025-05-30T03:17:13Z")

</div>

For example, the image dimension conversion and padding functions used in Hugging Face Transformers, such as Qwen 2 VL, seem to black out the alpha channel. This is probably not intentional. Or rather, it probably doesn’t have much meaning. It’s likely that the developers are just concerned with getting consistent results.  
(I think it’s probably left as is because in larger models, whether the background is black or white doesn’t seem to have a significant impact on the results…)

Regarding Pixtral, it seems to have been white-filled from the first commit, so I wonder if the model was trained with that in mind. Since there doesn’t seem to be any discussion about it, I think you’d have to ask the committer on GitHub for clarification.

> <https://github.com/huggingface/transformers/commit/8bd2b1e8c23234cd607ca8d63f53c1edfea27462#diff-bae85aac90878980e171650efdcd005df1d476c1a52d0b51b6657f6c69f4e5d9R153>
>
> \* initial commit
> 
> \* gloups
> 
> \* updates
> 
> \* work
> 
> \* weights match
> 
> \* nits…
> 
> \* nits
> 
> \* updates to support the tokenizer :)
> 
> \* updates
> 
> \* Pixtral processor (#33454)
> 
> \* rough outline
> 
> \* Add in image break and end tokens
> 
> \* Fix
> 
> \* Udo some formatting changes
> 
> \* Set patch\_size default
> 
> \* Fix
> 
> \* Fix token expansion
> 
> \* nit in conversion script
> 
> \* Fix image token list creation
> 
> \* done
> 
> \* add expected results
> 
> \* Process list of list of images (#33465)
> 
> \* updates
> 
> \* working image and processor
> 
> \* this is the expected format
> 
> \* some fixes
> 
> \* push current updated
> 
> \* working mult images!
> 
> \* add a small integration test
> 
> \* Uodate configuration docstring
> 
> \* Formatting
> 
> \* Config docstring fix
> 
> \* simplify model test
> 
> \* fixup modeling and etests
> 
> \* Return BatchMixFeature in image processor
> 
> \* fix some copies
> 
> \* update
> 
> \* nits
> 
> \* Update model docstring
> 
> \* Apply suggestions from code review
> 
> \* Fix up
> 
> \* updates
> 
> \* revert modeling changes
> 
> \* update
> 
> \* update
> 
> \* fix load safe
> 
> \* addd liscence
> 
> \* update
> 
> \* use pixel\_values as required by the model
> 
> \* skip some tests and refactor
> 
> \* Add pixtral image processing tests (#33476)
> 
> \* Image processing tests
> 
> \* Add processing tests
> 
> \* woops
> 
> \* defaults reflect pixtral image processor
> 
> \* fixup post merge
> 
> \* images -\> pixel values
> 
> \* oups sorry Mr docbuilder
> 
> \* isort
> 
> \* fix
> 
> \* fix processor tests
> 
> \* small fixes
> 
> \* nit
> 
> \* update
> 
> \* last nits
> 
> \* oups this was really breaking!
> 
> \* nits
> 
> \* is composition needs to be true
> 
> \---------
> 
> Co-authored-by: amyeroberts \<22614925+amyeroberts@users.noreply.github.com\>

> <https://github.com/huggingface/transformers/blob/main/src/transformers/image_transforms.py#L780>
