|
386 | 386 | % 23/04/23: (3.37) Fixed run-time error with old Matlab releases (issue #374); -notify console message about exported image now displays black (STDOUT) not red (STDERR) |
387 | 387 | % 15/05/23: (3.38) Fixed endless recursion when using export_fig in Live Scripts (issue #375); don't warn about exportgraphics/copygraphics alternatives in deployed mode |
388 | 388 | % 30/05/23: (3.39) Fixed exported bgcolor of uifigures or figures in Live Scripts (issue #377) |
| 389 | +% 06/07/23: (3.40) For Tiff compression, use AdobeDeflate codec (if available) instead of Deflate (issue #379) |
389 | 390 | %} |
390 | 391 |
|
391 | 392 | if nargout |
|
423 | 424 | [fig, options] = parse_args(nargout, fig, argNames, varargin{:}); |
424 | 425 |
|
425 | 426 | % Check for newer version and exportgraphics/copygraphics compatibility |
426 | | - currentVersion = 3.39; |
| 427 | + currentVersion = 3.40; |
427 | 428 | if options.version % export_fig's version requested - return it and bail out |
428 | 429 | imageData = currentVersion; |
429 | 430 | return |
|
659 | 660 |
|
660 | 661 | % Main processing |
661 | 662 | try |
| 663 | + oldWarn = warning; |
| 664 | + |
662 | 665 | % Export bitmap formats first |
663 | 666 | if isbitmap(options) |
664 | 667 | if abs(options.bb_padding) > 1 |
|
918 | 921 | t.setTag('ImageLength', size(img,1)); |
919 | 922 | t.setTag('ImageWidth', size(img,2)); |
920 | 923 | t.setTag('Photometric', Tiff.Photometric.RGB); |
921 | | - t.setTag('Compression', Tiff.Compression.Deflate); |
| 924 | + try %issue #379 use Tiff.Compression.AdobeDeflate by default |
| 925 | + compressionMode = Tiff.Compression.AdobeDeflate; |
| 926 | + catch |
| 927 | + warning off imageio:tiffmexutils:libtiffWarning %issue #379 |
| 928 | + compressionMode = Tiff.Compression.Deflate; |
| 929 | + end |
| 930 | + t.setTag('Compression', compressionMode); |
922 | 931 | t.setTag('PlanarConfiguration', Tiff.PlanarConfiguration.Chunky); |
923 | 932 | t.setTag('ExtraSamples', Tiff.ExtraSamples.AssociatedAlpha); |
924 | 933 | t.setTag('ResolutionUnit', Tiff.ResolutionUnit.Inch); |
|
1528 | 1537 | if ~nargout |
1529 | 1538 | clear imageData alpha |
1530 | 1539 | end |
| 1540 | + |
| 1541 | + % Revert warnings state |
| 1542 | + warning(oldWarn); |
1531 | 1543 | catch err |
| 1544 | + % Revert warnings state |
| 1545 | + warning(oldWarn); |
1532 | 1546 | % Revert figure properties in case they were changed |
1533 | 1547 | try set(fig,'Units',oldFigUnits, 'Position',pos, 'Color',tcol_orig); catch, end |
1534 | 1548 | % Display possible workarounds before the error message |
|
0 commit comments