force an image file to be in landscape mode

조회 수: 11 (최근 30일)
Branko Celler
Branko Celler 2017년 2월 22일
답변: Rik 2017년 2월 22일
No matter what I do in saving an image to a file, the orientation of the file is in portrait mode NOT landscape. This requires me to rotate the image should I need to copy it to a document The following does not work;
% Force image to be saved in landscape mode
h=gcf;
set(h,'PaperOrientation','landscape');
set(h,'PaperUnits','normalized');
set(h,'PaperPosition', [0 0 1 1]);
orient landscape
print(gcf, '-dtiffn', imagefilename);

답변 (1개)

Rik
Rik 2017년 2월 22일
Do you really need to export it as the result of a figure? Anyway, you can use
imwrite(imrotate(imread(imagefilename),90),imagefilename)
to load, rotate by 90 degrees and write again.

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by