Opened 3 years ago
Closed 3 years ago
#6911 closed defect (fixed)
Drawbox & drawgrid replace source pixels if input or box color has alpha
Reported by: | Gyan | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avfilter |
Version: | git-master | Keywords: | drawbox |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
If the video input has an alpha component or the user specifies transparency in the box/grid-color, the drawbox and drawgrid filters replace the source pixels when painting the box or grid. This is almost always undesired. The alpha component of the user color is meant for blending the box/grid on top of the input. The input alpha should be left intact. Essentially, the filters draw a "hole" if alpha is involved. See attached result-drawbox-src-with-no-alpha-existing.jpg
Inputs and outputs for
ffmpeg -i view.jpg -i window.png -lavfi "[1]drawbox=200:0:400:56:c=black@0.5:t=fill[win];[0][win]overlay" result-drawbox-src-with-alpha-existing.jpg
are attached, along with expected result.
Attachments (7)
Change History (9)
Changed 3 years ago by Gyan
Changed 3 years ago by Gyan
Changed 3 years ago by Gyan
Changed 3 years ago by Gyan
Changed 3 years ago by Gyan
comment:1 Changed 3 years ago by Gyan
Changed 3 years ago by Gyan
Changed 3 years ago by Gyan
comment:2 Changed 3 years ago by llogan
- Keywords drawbox added
- Resolution set to fixed
- Status changed from new to closed
Fixed by your patch in 1c76134fe37ac20695627e3f5ce1f2bbf1245fcc. Thanks.
Patch at https://patchwork.ffmpeg.org/patch/6701/ introduces a new boolean option 'replace'. If set to 1, yes or true, current behaviour is retained. With the default of 0, no or false, the behaviour is as shown in the 'expected' image.