import cv2 as cv
import matplotlib.pyplot as plt
from bitstring import BitStream, BitArray
with open("out.zip", "wb") as f:
for name in ["apngframe0438.png", "apngframe0580.png"]:
img = cv.imread(name)
blue_plane = img[:,:,0] & 1 # get LSB from 0'th channel (blue)
plt.imshow(blue_plane); plt.show() # debug printing so that we know we have the correct files
bits = "".join(blue_plane.flatten().astype(str)) # flatten 1920x1080 array of 0/1 to string
by = BitArray(bin=bits).tobytes() # bitstring to bytes
f.write(by)
Results in a zip containing a video: