Borrar filtros
Borrar filtros

is it possible to display the size of an image in MB or KB on matlab?????? if yes how??

19 visualizaciones (últimos 30 días)
plezzz hel asap!!

Respuestas (1)

Raghava S N
Raghava S N hace alrededor de 3 horas
Editada: Raghava S N hace 26 minutos
Hi Pradeep,
Yes, it is possible to display the size of an image in MB or KB in MATLAB. You can achieve this by calculating its size based on the number of bytes it occupies in memory.
The image size can be calculated using the “imfinfo” function. The “FileSize” output argument of the “imfinfo” function returns the size of the file in bytes. More information about extracting metrics about a graphics file using the “imfinfo” function can be found in this link - https://www.mathworks.com/help/matlab/ref/imfinfo.html#:~:text=character%20vector-,FileSize,-Size%20of%20the.
Here is some sample code to find the size of a graphics file in MATLAB –
imageFilePath = 'path_to_your_image.jpg'; % Replace with your image file path
% Get the size of the image in bytes
info = imfinfo(imageFilePath);
imageSizeInBytes = info.FileSize;
% Convert bytes to KB and MB
imageSizeInKB = imageSizeInBytes / 1024;
imageSizeInMB = imageSizeInKB / 1024;
Hope this helps!
  2 comentarios
Stephen23
Stephen23 hace 39 minutos
"Firstly, use the “imread” function to load your image into MATLAB."
Why is that required?
Although your code imports the image data into IMAGEDATA, it does not use it for anything.
Raghava S N
Raghava S N hace 28 minutos
Editada: Raghava S N hace 27 minutos
You are quite right. imread is not necessary here. That's an oversight from my end. Will edit it out soon.

Iniciar sesión para comentar.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by