opening a .bmp with photoshop

5 ビュー (過去 30 日間)
mohammad
mohammad 2012 年 8 月 4 日
コメント済み: Christa Elrod 2020 年 3 月 3 日
There is a .bmp file in directory c:\folder\mm.bmp. I want to open it with photoshop from inside of MATLAB with command. Any idea?

採用された回答

Image Analyst
Image Analyst 2012 年 8 月 4 日
Use this code. Adapt it to reflect the actual filename of your image and your Photoshop location.
clc;
%-----------------------------------------------------------------------------
% Get the name of the image file. Get the full filename, with path prepended.
% Use a standard MATLAB color demo image.
folder = fullfile(matlabroot, '\toolbox\images\imdemos');
baseFileName = 'peppers.png';
% Get the full filename, with path prepended.
fullImageFileName = fullfile(folder, baseFileName);
if ~exist(fullImageFileName, 'file')
% Didn't find image. Alert user.
errorMessage = sprintf('Error: image\n%s\ndoes not exist.', fullImageFileName);
uiwait(warndlg(errorMessage));
return;
end
% Check to see that Photoshop executable exists.
editorFullFileName = 'C:\Program Files\Adobe\Adobe Photoshop CS5 (64 Bit)\Photoshop.exe';
if ~exist(editorFullFileName, 'file')
errorMessage = sprintf('Cannot find the Photoshop program.\n%s', editorFullFileName);
uiwait(warndlg(errorMessage));
return;
end
% Now run the Photoshop program, passing in the image filename.
% First construct the command line for the system() function.
% Enclose all filenames in double quotes because we may have spaces in the filenames.
arguments = sprintf('"%s"', fullImageFileName);
commandLine = sprintf('"%s" %s', editorFullFileName, arguments);
fprintf('%s', commandLine);
% Now launch the Photoshop program using the "system()" function.
system(commandLine);
  6 件のコメント
Image Analyst
Image Analyst 2014 年 1 月 9 日
You can also try Jeff's utility to read Photoshop PSD files from MATLAB: http://www.mathworks.com/matlabcentral/fileexchange/4730-adobe-photoshop-psd-file-reader
Christa Elrod
Christa Elrod 2020 年 3 月 3 日
Thanks for the code @imageanalyst.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by