Code covered by the BSD License  

Highlights from
Adobe Photoshop PSD file reader

from Adobe Photoshop PSD file reader by Jeff Mather
Functions to read images and get metadata from Adobe Photoshop PSD files.

ispsd(filename)
function tf = ispsd(filename)
%ISBMP Returns true for an Adobe Photoshop PSD file.
%   TF = ISPSD(FILENAME)

%   Author: Jeff Mather
%   Copyright 1984-2004 The MathWorks, Inc.

% Open the file.
fid = fopen(filename, 'r', 'ieee-be');

if (fid < 0)
    tf = false;
    return
end

FormatSignature = fread(fid, 4, 'uint8=>char');
if (~isequal(FormatSignature', '8BPS'))
    fclose(fid);
    tf = false;
    return
end

FormatVersion = fread(fid, 1, 'uint16=>uint16');
if (FormatVersion ~= 1)
    fclose(fid);
    tf = false;
    return
end

tf = true;

Contact us at files@mathworks.com