필터 지우기
필터 지우기

matlab figure saving dim

조회 수: 2 (최근 30일)
Anmol Pardeshi
Anmol Pardeshi 2020년 5월 22일
댓글: Ameer Hamza 2020년 5월 22일
has anyone observed that if a matlab figure is saved as a jpg, its dimension in the jpg changes. is this true?
I have two images and the description is below :
img A -> .fig size = 638x816x3 || .jpg size = 733x988x3
img B -> .fig size = 638x816x3 || .jpg size = 963x1904x3
it seems that there is some scaling done while saving images as jpg. Further, the scaling doesn't seem to be generalized since the sizes of my .fig files are the same but the output jpgs are different.
Pls explain how to save with same dimensions.
  댓글 수: 2
Ameer Hamza
Ameer Hamza 2020년 5월 22일
How do you determine the size of a file? fig files are not raster images, so they are not stored in the form of pixels. Also, what function are you using to save .jpeg files?
Anmol Pardeshi
Anmol Pardeshi 2020년 5월 22일
I determine the size by importing the image on the workspace. As far as the saving method is concerned, I'm using the 'saveas' option from the file menu option. I do acknowledge that if the figure is stored, as jpg, from the code itself, the size remains the same.

댓글을 달려면 로그인하십시오.

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 5월 22일
편집: Ameer Hamza 2020년 5월 22일
It seems that you are trying to save an image matrix as a jpeg. saveas() is not the correct function if you want to preserve the resolution of your image. Use imwrite(): https://www.mathworks.com/help/releases/R2020a/matlab/ref/imwrite.html
saveas does not recognize that there is an image present in the figure window. It merely rasterizes all the content of your figure and saves it as an image.
  댓글 수: 2
Anmol Pardeshi
Anmol Pardeshi 2020년 5월 22일
I speculated something like this. imwrite() should preserve the size because it saves the image "matrix" as it is where as the saveas from the file menu option on the top console should follow some other process of basic image processing & saving.
Thanks fr the prompt and continuous replies, Ameer! Hope you keep safe in the COVID situation.
Ameer Hamza
Ameer Hamza 2020년 5월 22일
Thanks, and I wish the same for you. I am glad to be of help!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Display Image에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by