It may be an easy question but I can not configure it?

        obj = bpy.data.objects['img']
        mat = obj.active_material
        texImage = mat.node_tree.nodes["Image Texture"]
        texImage.image = bpy.data.images.load(p)

Above script working fine when I try to load the image from the local drive ie p='C:\Users\Downloads\pic\dog .png' but when I used the online URL ie p='https://cdn-icons-png.flaticon.com/512/2930/2930628.png' it was not working. So how can I do this? so that I can use the online URL. Any solution will be appreciated.

  • $\begingroup$ Blender's file I/O does not support using URLs, so the only thing that will work for you is to use an external program to download the file or to use python's HTML library to do the download. In either case you'll have to store the file locally before you can use it in Blender. $\endgroup$ Jun 1, 2022 at 17:09

1 Answer 1


You can do it like this.

import requests 

path = "the/path/for/the/image/test_image.jpeg"

r = requests.get('https://cdn-icons-png.flaticon.com/512/2930/2930628.png')
if r.status_code == 200:
    with open(path, 'wb') as f:
        for chunk in r:


enter image description here

After that you should be able to read the image into Blender using the local file path.

  • 1
    $\begingroup$ Thanks, sir @Jakemoyo. It works fine as I wanted. $\endgroup$
    – SAHU
    Jun 4, 2022 at 18:40
  • $\begingroup$ Can you accept it as the answer so it gets removed from the unanswered questions pool? $\endgroup$
    – Jakemoyo
    Jun 5, 2022 at 13:54

Not the answer you're looking for? Browse other questions tagged .