Effacer les filtres
Effacer les filtres

export_fig with transparent background and fixed size?

19 vues (au cours des 30 derniers jours)
Tim Hilt
Tim Hilt le 14 Fév 2020
Modifié(e) : Tim Hilt le 14 Fév 2020
I try to create a .gif with transparent background. This is achieveable by exporting .png figures with transparent background for every frame i want to include in the .gif. This works great with export_fig (export_fig(sprintf('out/sensor1/%03d_sensor1', i), '-transparent', '-png')), however, i think that export_fig only exports the area with filled content, which leads to different image-sizes, because my plots are surf-plots without any axis and with changing content. When i then try to combine them into a transparent .gif with ImageMagick, the different sizes of the single frames lead to a shifting-effect along the y-direction of the animation.
Pythons Matplotlib exports with a fixed figure-size. How can i tell export_fig the specific image-size i want the exported .png graphics to have?

Réponse acceptée

Tim Hilt
Tim Hilt le 14 Fév 2020
Modifié(e) : Tim Hilt le 14 Fév 2020
Somebody should have given me an RTFM: There is the -nocrop-option which enables export_fig to do exactly what i wanted to achieve. I'm calling the function like:
export_fig(sprintf('out/sensor1/%03d_sensor1', i), '-nocrop', '-transparent', '-png')

Plus de réponses (0)

Catégories

En savoir plus sur Lighting, Transparency, and Shading dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by