MATLAB Answers

How can I convert a lena.bmp image to lena.tif?

22 ビュー (過去 30 日間)
tina jain
tina jain 2016 年 5 月 7 日
回答済み: Image Analyst 2016 年 5 月 7 日
Is there any function in MATLAB which convert the image type? If i rename the name of the image manually from "lena.bmp" to "lena.tif" than will it work?

  1 件のコメント

Stephen Cobeldick
Stephen Cobeldick 2016 年 5 月 7 日
The file type is not determined by the file extension (in fact on linux files are not even required to have a file extension). You cannot just change an image file format by changing its file extension. You need to use MATLAB or any reputable image viewer/editor to convert from one format to another.

サインインしてコメントする。

回答 (3 件)

CS Researcher
CS Researcher 2016 年 5 月 7 日
Read the image in
I = imread(name.bmp);
h = imshow(I);
saveas(h,name,'tif');
In you case name is 'lena'. Hope this helps!

  0 件のコメント

サインインしてコメントする。


Stephen Cobeldick
Stephen Cobeldick 2016 年 5 月 7 日
The file type is not determined by the file extension (in fact on linux files are not even required to have a file extension). You cannot just change an image file format by changing its file extension. You can use MATLAB:
Or it would likely be much easier to simply use any reputable image viewer/editor, such as MS Paint, or Irfanview.

  0 件のコメント

サインインしてコメントする。


Image Analyst
Image Analyst 2016 年 5 月 7 日
Use strrep (or fileparts), and imread() and imwrite(). Simply change the filename.
inputFileName = 'C:/whatever folder/lena.bmp'
outputFileName = strrep(inputFileName, '.bmp', '.tif')
theImage = imread(inputFileName);
imwrite(theImage, outputFileName);

  0 件のコメント

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by