E
E
Evgeny Petryaev2021-12-02 19:12:32
MATLAB
Evgeny Petryaev, 2021-12-02 19:12:32

How to download an image from github?

I want to access the url of the image and write it down for download and display by matlab

clc;
clear;
imageUrl='https://github.com/Beginerok/Tropic-Island/blob/master/Tropic-Island/Gamedev/Demo2/Demo2/content/atlas.png';
rgb = webread(imageUrl);
tree = htmlTree(rgb);
selector = "img";
subtrees = findElement(tree,selector)
tmpr='https://github.com';
strp = string(subtrees(5));
ch=strp.char()

for j=11:1:length(ch)
    if ch(j)~='?'
        tmpr=strcat(tmpr,ch(j));
    else
        break;
    end
end
tmpr
rgb = webread(tmpr)
whos rgb
rgb = imresize(rgb, 0.6);
imshow(rgb)

In short, I get the page, I parse it, I upload it again - I get the page, the image does not get

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question