Resize an Image while preserving aspect ratio in MATLAB Report Generator R2018a

12 visualizzazioni (ultimi 30 giorni)
I would like to resize my image in MATLAB Report Generator but preserve the aspect ratio. I am using the method described in the link below, but I have not found an easy way to preserve the aspect ratio.

Risposta accettata

MathWorks Support Team
MathWorks Support Team il 19 Apr 2019
Modificato: MathWorks Support Team il 18 Apr 2019
See the example which shows how if you only specify the "Height" in the "<image>.Style" property and not the "Width", then the aspect ratio is preserved.
import mlreportgen.dom.*
%create document
d = Document('imageArea2','pdf');
%create two images, origional and resized
img_orig = Image('circle.png');
img_resize = Image('circle.png');
%resize one image
img_resize.Style = {Height('2.5in')}; %the new height we want in inches
%add both to document and view
append(d,img_orig);
append(d,img_resize);
close(d);
rptview(d.OutputPath);

Più risposte (0)

Categorie

Scopri di più su MATLAB Report Generator in Help Center e File Exchange

Prodotti


Release

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by