MATLAB: Image array as ImageSource for uiimage result in high jpg compression

app designerimage processingimagesourceimreadlow qualityMATLABuiimage

I am doing some image processing on a image for a app. I have encountered a problem that the image shown by uiimage is low quality (maybe jpeg compression). The code example below shows two ways of displaying the same image with uiimage with two different results (right low quality, left normal).
Can i do something to stop the quality/compression ?
f = uifigure('Position',[20 20 440 210]);
im = uiimage(f,'Position',[10 10 200 200]);
im2 = uiimage(f,'Position',[230 10 200 200]);
imloadet = imread('membrane.png');
im.ImageSource = 'membrane.png';
im2.ImageSource = imloadet;
Thanks in advance for the help

Best Answer

  • This is the expected behavior for uiimage component.
    ImageSource property accepts JPEG, PNG, GIF, SVG file formats along with m-by-n-by-3 truecolor image array.
    Recommendation is to use image files directly such as PNG format for best quality in the above coding steps.
    Truecolor image array is for convenience to support image array and other file formats not supported directly. Image quality might not be be best when using truecolor image array though.