Skip to content

Commit

Permalink
(3.04) Workaround for issue #15; alert if ghostscript file not found …
Browse files Browse the repository at this point in the history
…on Matlab path
  • Loading branch information
altmany committed Mar 22, 2020
1 parent 49b5bb4 commit 9974724
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion export_fig.m
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,11 @@
% 15/01/20: (3.01) Clarified/fixed error messages; added error IDs; easier -update; various other small fixes
% 20/01/20: (3.02) Attempted fix for issue #285: unsupported patch transparency in some Ghostscript versions; improved suggested fixes message upon error
% 03/03/20: (3.03) Suggest to upload problematic EPS file in case of a Ghostscript error in eps2pdf (& don't delete this file)
% 22/03/20: (3.04) Workaround for issue #15; alert if ghostscript file not found on Matlab path
%}

% Check for newer version (not too often)
checkForNewerVersion(3.03);
checkForNewerVersion(3.04);

if nargout
[imageData, alpha] = deal([]);
Expand Down Expand Up @@ -611,6 +612,14 @@

% Set the background colour (and size) back to normal
set(fig, 'Color', tcol, 'Position', pos);
% Workaround for issue #15
szA = size(A);
szB = size(B);
if ~isequal(szA,szB)
A = A(1:min(szA(1),szB(1)), 1:min(szA(2),szB(2)), :);
B = B(1:min(szA(1),szB(1)), 1:min(szA(2),szB(2)), :);
warning('export_fig:bitmap:sizeMismatch','Problem detected by export_fig generation of a bitmap image; the generated export may look bad. Try to reduce the figure size to fit the screen, or avoid using export_fig''s -transparent option.')
end
% Compute the alpha map
alpha = round(sum(B - A, 3)) / (255 * 3) + 1;
A = alpha;
Expand Down

0 comments on commit 9974724

Please sign in to comment.