1

I have a set of RGB images (size (400,200,3)) that I'm animating using matplotlib.animation and I want to overlay an RGBA image (size (400,200,4)) on top of them. It seems that FFMPEG is choking on the alpha data that gets added when I overlay the second image using axes.add_image() (it works fine without the overlay). I was wondering if there is a way to overlay the second image and eliminate the alpha data before I pass it along to matplotlib.animation as I think this will solve the problem.

I'm using python 2.7.9 and matplotlib 1.4.2.

kjgregory
  • 656
  • 2
  • 12
  • 23

1 Answers1

1

You have a two step problem. First you need to combine to RGBA images, then you want to map RGBA -> RGB. Note that mapping your first image from RGB -> RGBA is trivial by setting the alpha mask to fully opaque. Both of these questions have already been solved on SO.

  1. Combining RGBA + RGBA:

    Determine RGBA colour received by combining two colours

  2. Mapping RGBA -> RGB:

    Convert RGBA color to RGB

Community
  • 1
  • 1
Hooked
  • 84,485
  • 43
  • 192
  • 261