export_fig with transparent background and fixed size?

조회 수: 39 (최근 30일)
Tim Hilt
Tim Hilt 2020년 2월 14일
편집: Tim Hilt 2020년 2월 14일
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?

채택된 답변

Tim Hilt
Tim Hilt 2020년 2월 14일
편집: Tim Hilt 2020년 2월 14일
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')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by