フィルターのクリア

why i can not use imwrite?

5 ビュー (過去 30 日間)
Behrad kiani
Behrad kiani 2013 年 11 月 9 日
回答済み: Image Analyst 2013 年 11 月 10 日
I am using imwrite function in matlab but it shows me : ??? Error using ==> imwrite at 457 Can't open file "moosh.jpg" for writing. You may not have write permission.
Error in ==> Untitled at 4 imwrite(pic , 'moosh.jpg');
I searched forum and other people have the same problem too but there were no certain answer.is the problem is something about my win 8?? please help.it is a very simple problem that makes me nervous. thank you my code is:
pic=imread('1.jpg');
imwrite(pic , 'moosh.jpg');

採用された回答

Image Analyst
Image Analyst 2013 年 11 月 10 日
What folder are you trying to save it in? I noticed you are not using fullfile() and trying to save into whatever the current folder happens to be. That's not as robust as saving it with the full folder and base filename and extension. If you hard code the folder name in there do you still get the error?
fullFileName = fullfile('d:\myImages\Behard', 'moosh.jpg');
imwrite(fullFileName);
You might have that file open in another program. Does it do the same after restarting MATLAB or the computer?

その他の回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 11 月 9 日
編集済み: Azzi Abdelmalek 2013 年 11 月 9 日
Maybe the file moosh.jpg exists already and is read only. Try another name.
  2 件のコメント
Behrad kiani
Behrad kiani 2013 年 11 月 9 日
I checked it.it wasn't
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 11 月 9 日
change a folder (from C: to D: for example)

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

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by