AcademySoftwareFoundation / AcademySoftwareFoundation/OpenImageIO
[BUG]Issue on transparent background with ImageBufAlgo.over
- Dominant language
- C++
- Stars
- 2.4k
- Forks
- 698
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 47
Description
**Describe the bug**
While using `ImageBugAlgo.over(fg, bg)`
If fg is a half transparent image with a fully transparent background, the background part show a color on it.
**OpenImageIO version and dependencies**
I used `pip install joon-oiio`
ran `vcpkg install openimageio[pybind11,freetype]` and followed the instruction in this [git repository](https://github.com/Correct-Syntax/py-oiio)
Bug tested on openimageio[core,pybind11,freetype]:x64-windows@2.5.14.0
`openimageio_version 20514`
**To Reproduce**
Steps to reproduce the behavior:
1. Install oiio as said above
2. "fg.png" should be a half transparent image with a fully transparent background
3. In a python file, run this code :
```
import oiio
from oiio import ImageBufAlgo, ImageBuf
fg = ImageBuf("fg.png")
bg = ImageBuf("bg.png")
if fg.spec().alpha_channel < 0 :
RGB = ImageBufAlgo.channels (fg, (0, 1, 2))
fg = ImageBufAlgo.channels (RGB, ("R", "G", "B", 1.0),("R", "G", "B", "A"))
if bg.spec().alpha_channel < 0 :
RGB = ImageBufAlgo.channels (bg, (0, 1, 2))
bg = ImageBufAlgo.channels (RGB, ("R", "G", "B", 1.0),("R", "G", "B", "A"))
composite = ImageBufAlgo.over (fg, bg)
composite.write("image.png")
```
Output:

5. The fb.png should just be on top of the bg.png, instead fg.png show some color where the pixel should be transparent.
**Evidence**
- In some previous version, if I run the same code, I get a correct output, with the fg.png background being fully transparent as it should. Tested and working on OpenImageIo version 20414
- `openimageio_version 20414`
- Expected result:

Contributor guide
Research direction
Start at the ImageBufAlgo.over entry point and reproduce the report with the supplied Python example using OpenImageIO 2.5.14. Compare its output with the reported 2.4.14 behavior, focusing on fully transparent foreground pixels. Done means transparent background pixels no longer introduce visible color while compositing, with the reproduction behavior covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, python
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100