How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)

Please respect the original work.Reprint must indicate the link to this article.And the author of the article: slandarer

How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)

All image resources are at the end of the article.

Two years ago, I wrote about how to use MATLAB to scrape all illustrations from Nature. Recently, someone asked me if I had a compressed package of the downloaded illustrations for 2024 and 2025, so I ran the code again and found that the code I wrote two years ago still works today. The code is as follows:

function getNaturePNGWhileTure(YEAR)
if nargin < 1
    YEAR = 2024;
end

pbegin = 1; ibegin = 1; jbegin = 1; 
forderName=['Year_',num2str(YEAR)];
if exist(['.\image_',forderName,'\pijbreak.mat'],'file')
    load(['.\image_',forderName,'\pijbreak.mat']);
end
if ~exist(['.\image_',forderName],'dir')
    mkdir(['.\image_',forderName]);
end
disp([pbegin,ibegin,jbegin])

url_full = 'https://www.nature.com/nature/research-articles?searchType=journalSearch&sort=PubDate&year=<Y/>&page=<P/>';
url_year = strrep(url_full,'&lt;Y/&gt;',num2str(YEAR));

options=weboptions('Timeout',inf);
html_year  = webread(strrep(url_year,'&lt;P/&gt;','1'),options);fprintf('1->')
A_page_num = strfind(html_year,'u-visually-hidden'); 
Z_page_num = strfind(html_year,'data-page="next");
page_num   = html_year(A_page_num(find(A_page_num<Z_page_num,1,'last')):Z_page_num);
page_num   = page_num(32:36);
page_num   = str2double(page_num(abs(page_num)<=57&abs(page_num)>=48));

for p = pbegin:page_num
    url_page  = strrep(url_year,'&lt;P/&gt;',num2str(p));
    html_page = webread(url_page,options);fprintf('2\n')
    A_html_artical = strfind(html_page,'itemprop="name headline"');
    Z_html_artical = strfind(html_page,'data-track-action="view article"');

    for i = ibegin:length(Z_html_artical)
        html_artical = html_page(A_html_artical(find(A_html_artical<Z_html_artical(i),1,'last')):Z_html_artical(i));
        A_artical    = strfind(html_artical,'&lt;a href=');
        Z_artical    = strfind(html_artical,'class="c-card__link u-link-inherit"');
        html_artical = html_artical(A_artical(1)+10:Z_artical);
        html_artical = html_artical(1:find(html_artical=='"')-1);

        for j = jbegin:50
            pbegin = p; ibegin = i ; jbegin = j;
            save(['.\image_',forderName,'\pijbreak.mat'],'pbegin','ibegin','jbegin')
            html_png=webread(['https://www.nature.com/',html_artical,'/figures/',num2str(j)]);
            A_png = strfind(html_png,'aria-describedby');
            Z_png = strfind(html_png,'alt="Fig.');
            
            if isempty(Z_png)
                break;
            else
                url_png  = html_png(A_png:Z_png(find(Z_png>A_png,1)));
                url_png  = ['https:',url_png(strfind(url_png,'src="')+5:end-3)];
                url_png  = strrep(url_png,'lw685','full');
                name_png = ['.\image_',forderName,'\',html_artical(10:end),' Fig-',num2str(j)];
                websave(name_png,url_png,options);
            disp(['Downloading Year-',num2str(YEAR),...
                ' Page-',num2str(p),' Artical-',num2str(i),...
                ' Fig-',num2str(j),':',html_artical])
            end
        end
        jbegin = 1;
    end
    ibegin = 1;
end
end

The usage is very simple. For example, to download images from 2024, run the command in the command line window: <span>getNaturePNGWhileTure(2024)</span>:

The code has breakpoints set, allowing you to pause halfway through the download and continue later. The saved file names correspond to the paper numbers. For example, if I want to see the original text of the interesting image below:

How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)

We can see that the article number is s41586-023-06728-8. We just need to search:

  • https://www.nature.com/articles/s41586-023-06728-8
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)

Next, I will showcase some interesting or visually appealing new images, and at the end of the article, I will provide resources for all images from these three years, totaling over ten thousand images.

Partial Image Showcase

2023

How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)

2024

How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)

2025

How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)

Resource Links

2023 (Total 5068 images)

  • https://pan.baidu.com/s/1iEMBewOyPbJNejhkxLhISg?pwd=slan

2024 (Total 5550 images)

  • https://pan.baidu.com/s/1Fk5J9TY_6ZaVqqF-flDcLQ?pwd=slan

2025 (Total 2930 images)

  • https://pan.baidu.com/s/1ji-uuc5dx-bpg43RykY_aQ?pwd=slan
How to Use MATLAB to Retrieve All Illustrations from Nature (Including Images from 2023-2025)

Leave a Comment