C2QA / bosonic-qiskit

Extension of Qiskit to support hybrid boson-qubit simulations for the NQI C2QA effort.
BSD 2-Clause "Simplified" License
46 stars 11 forks source link

Improve GIF animation resolution (banding) #61

Closed tjstavenger-pnnl closed 2 years ago

tjstavenger-pnnl commented 2 years ago

Kevin notes:

The .gif resolution (at least for me) is very, very low. Much lower than the .pngs that are saved. So maybe we could add an option to up the resolution?

The animated gif has banding in place of smooth/gradual gradient that you get in an mp4. Investigate how/if that could be improved to get GIF to look more like MP4.

tjstavenger-pnnl commented 2 years ago

GIF (and animated GIF) files are limited to 256 colors. Gradients often will appear banded as there simply are not enough colors to get a smooth gradient like you'll find with MP4.

I added code to support APNG (really just a change to not show warning messages if it is selected) via matplotlib.animation.PillowWriter. This format supports more colors and a smoother gradient, while not requiring ffmpeg to be installed (as needed for MP4). The drawback is that the format isn't as widely supported as GIF. Though Chrome, Firefox, and other browsers tend to be able to render it.