# Blazingly fast preview loads. Images of arbitrary size. bpy.utils.previews drop-in replacement

**URL:** <https://blenderartists.org/t/blazingly-fast-preview-loads-images-of-arbitrary-size-bpy-utils-previews-drop-in-replacement/1303349>\
**Category:** Released Add-ons and Extensions\
**Tags:** code\
**Created:** [May 10, 2021, 3:42am UTC](https://blenderartists.org/t/blazingly-fast-preview-loads-images-of-arbitrary-size-bpy-utils-previews-drop-in-replacement/1303349 "2021-05-10T03:42:53Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![core-process](https://blenderartists.org/user_avatar/blenderartists.org/core-process/32/658318_2.png) [@core-process](https://blenderartists.org/u/core-process)\
**Post date:** [May 10, 2021, 3:42am UTC](https://blenderartists.org/t/blazingly-fast-preview-loads-images-of-arbitrary-size-bpy-utils-previews-drop-in-replacement/1303349/1 "2021-05-10T03:42:53Z")

</div>

Hey all,

We created a new Python library for Blender called _3DN BIP_ or _3D Ninjas Blender Image Preview_. It allows blazingly fast preview loads in Blender. Furthermore, it can load preview images of arbitrary size. It operates as an `bpy.utils.previews` drop-in replacement and does all the heavy lifting for you.

Give it a spin: [https://github.com/3dninjas/3dn-bip](https://github.com/3dninjas/3dn-bip)

We are looking forward to your feedback, proposals and improvements.

Niklas

---

<div class="post-metadata">

**Author:** ![Nanomanpro](https://blenderartists.org/user_avatar/blenderartists.org/nanomanpro/32/18745_2.png) [@Nanomanpro](https://blenderartists.org/u/Nanomanpro)\
**Post date:** [May 10, 2021, 5:56am UTC](https://blenderartists.org/t/blazingly-fast-preview-loads-images-of-arbitrary-size-bpy-utils-previews-drop-in-replacement/1303349/2 "2021-05-10T05:56:05Z")

</div>

If I understand well, this is a solution that will allow to speed up the generation of thumbnails for an example in various types of addons that use this type of functionality?

---

<div class="post-metadata">

**Author:** ![core-process](https://blenderartists.org/user_avatar/blenderartists.org/core-process/32/658318_2.png) [@core-process](https://blenderartists.org/u/core-process)\
**Post date:** [May 10, 2021, 10:39am UTC](https://blenderartists.org/t/blazingly-fast-preview-loads-images-of-arbitrary-size-bpy-utils-previews-drop-in-replacement/1303349/3 "2021-05-10T10:39:13Z")

</div>

When you load multiple preview images in the Blender UI, it can sometimes take several seconds for them to load completely. With our library, preview images are loaded in milliseconds. Developers can use the library for their addons. The library is especially appealing if you offer a selection of assets and show preview images for them.

---

<div class="post-metadata">

**Author:** ![lsscpp](https://blenderartists.org/user_avatar/blenderartists.org/lsscpp/32/3452_2.png) [@lsscpp](https://blenderartists.org/u/lsscpp)\
**Post date:** [May 10, 2021, 1:19pm UTC](https://blenderartists.org/t/blazingly-fast-preview-loads-images-of-arbitrary-size-bpy-utils-previews-drop-in-replacement/1303349/4 "2021-05-10T13:19:44Z")

</div>

Does it work also for regular previews in the File browser window? I mean, if I enable the addon will it help when opening a folder full of images (jpg, exr, png, tif, etc) in the file browser, say to choose a texture for a shader?

---

<div class="post-metadata">

**Author:** ![core-process](https://blenderartists.org/user_avatar/blenderartists.org/core-process/32/658318_2.png) [@core-process](https://blenderartists.org/u/core-process)\
**Post date:** [May 10, 2021, 2:13pm UTC](https://blenderartists.org/t/blazingly-fast-preview-loads-images-of-arbitrary-size-bpy-utils-previews-drop-in-replacement/1303349/5 "2021-05-10T14:13:54Z")

</div>

Interesting idea. I don’t know if that is possible w/o modifying Blender itself. But we will have a look at it.

Currently, 3DN BIP is an embeddable library for add-on developers. They can copy the folder into their add-on and use the library instead of `bpy.utils.previews`.

---

<div class="post-metadata">

**Author:** ![lsscpp](https://blenderartists.org/user_avatar/blenderartists.org/lsscpp/32/3452_2.png) [@lsscpp](https://blenderartists.org/u/lsscpp)\
**Post date:** [May 11, 2021, 7:53am UTC](https://blenderartists.org/t/blazingly-fast-preview-loads-images-of-arbitrary-size-bpy-utils-previews-drop-in-replacement/1303349/6 "2021-05-11T07:53:29Z")

</div>

Ok thanks.  
I took a look and figure out what this library does. Nice. Fast browser previews would be nice too since when you open a crowded folder the lag is annoiyng, and the previews somtimes are useless because they’re too small

---

<div class="post-metadata">

**Author:** ![ulf3000](https://blenderartists.org/user_avatar/blenderartists.org/ulf3000/32/793803_2.png) [@ulf3000](https://blenderartists.org/u/ulf3000)\
**Post date:** [May 15, 2021, 1:05pm UTC](https://blenderartists.org/t/blazingly-fast-preview-loads-images-of-arbitrary-size-bpy-utils-previews-drop-in-replacement/1303349/7 "2021-05-15T13:05:16Z")

</div>

in that case why dont you directly write a patch and apply? so blender uses your superiour library by default.

Stuff like this is really amazing. Great work guys !

---

<div class="post-metadata">

**Author:** ![core-process](https://blenderartists.org/user_avatar/blenderartists.org/core-process/32/658318_2.png) [@core-process](https://blenderartists.org/u/core-process)\
**Post date:** [May 16, 2021, 7:44pm UTC](https://blenderartists.org/t/blazingly-fast-preview-loads-images-of-arbitrary-size-bpy-utils-previews-drop-in-replacement/1303349/8 "2021-05-16T19:44:47Z")

</div>

KIT OPS is using 3DN BIP now. See for yourself!

[![](https://blenderartists.org/uploads/default/original/4X/8/6/6/866be9a2dfceb284bd741a345934b81bf09812d4.jpeg "KIT OPS FREE + PRO: bronson edition BIG NEWS") ](https://www.youtube.com/watch?v=_ZyNrptwtik)

(credits to @bonjorno7 for the 3DN BIP code and @thefauxrogue for the documentation and testing)

---

<div class="post-metadata">

**Author:** ![core-process](https://blenderartists.org/user_avatar/blenderartists.org/core-process/32/658318_2.png) [@core-process](https://blenderartists.org/u/core-process)\
**Post date:** [May 22, 2021, 12:42pm UTC](https://blenderartists.org/t/blazingly-fast-preview-loads-images-of-arbitrary-size-bpy-utils-previews-drop-in-replacement/1303349/9 "2021-05-22T12:42:20Z")

</div>

Brush Manager is using 3DN BIP now. See for yourself!

> [@Brush Manager for Blender 2.83+ \[Sculpt, Image Paint, Vertex Paint, Weight Paint, Grease Pencil\]](https://blenderartists.org/t/brush-manager-for-blender-2-83-sculpt-image-paint-vertex-paint-weight-paint-grease-pencil/1241837/46):
>
> Brush Manager 1.2.9 Integrated 3DN BIP or 3D Ninjas Blender Image Preview library, which allows real fast preview image loads in Blender. Now brush icons will load instantly from the very start if 3DN BIP library is turned on in the Settings. Installation of python module ‘Pillow’ is required. More info about library at the developers page [https://github.com/3dninjas/3dn-bip/](https://github.com/3dninjas/3dn-bip/) Now properly saves favorites settings for every mode if ‘Save Favorites List to the Current File’ preference setting is…

---

<div class="post-metadata">

**Author:** ![core-process](https://blenderartists.org/user_avatar/blenderartists.org/core-process/32/658318_2.png) [@core-process](https://blenderartists.org/u/core-process)\
**Post date:** [June 4, 2021, 7:49pm UTC](https://blenderartists.org/t/blazingly-fast-preview-loads-images-of-arbitrary-size-bpy-utils-previews-drop-in-replacement/1303349/10 "2021-06-04T19:49:37Z")

</div>

Graswald is using 3DN BIP and our new Asset Browser now. See for yourself!

[https://twitter.com/graswald\_3d/status/1400895600456048644](https://twitter.com/graswald_3d/status/1400895600456048644)

---

<div class="post-metadata">

**Author:** ![Shiroi\_Akuma](https://blenderartists.org/user_avatar/blenderartists.org/shiroi_akuma/32/638344_2.png) [@Shiroi\_Akuma](https://blenderartists.org/u/Shiroi_Akuma)\
**Post date:** [June 6, 2021, 6:30am UTC](https://blenderartists.org/t/blazingly-fast-preview-loads-images-of-arbitrary-size-bpy-utils-previews-drop-in-replacement/1303349/11 "2021-06-06T06:30:45Z")

</div>

So cool! The thumbnails always loaded slow and I thought it was my PC thanks for creating this library I am sure it will improve a lot of addons!

---

<div class="post-metadata">

**Author:** ![core-process](https://blenderartists.org/user_avatar/blenderartists.org/core-process/32/658318_2.png) [@core-process](https://blenderartists.org/u/core-process)\
**Post date:** [June 6, 2021, 9:10am UTC](https://blenderartists.org/t/blazingly-fast-preview-loads-images-of-arbitrary-size-bpy-utils-previews-drop-in-replacement/1303349/12 "2021-06-06T09:10:43Z")

</div>

Cool! 🙂 We would be delighted if as many addon developers as possible were made aware of the library. Please help us to spread the word! 🙂

---

<div class="post-metadata">

**Author:** ![AlexeyAdamitsky](https://blenderartists.org/user_avatar/blenderartists.org/alexeyadamitsky/32/630057_2.png) [@AlexeyAdamitsky](https://blenderartists.org/u/AlexeyAdamitsky)\
**Post date:** [June 14, 2021, 2:12pm UTC](https://blenderartists.org/t/blazingly-fast-preview-loads-images-of-arbitrary-size-bpy-utils-previews-drop-in-replacement/1303349/13 "2021-06-14T14:12:36Z")

</div>

Thanks for developing this! I also with you would write a patch for Blender to use this natively. I have big libraries of textures and it would be amazing if the images were generated as fast as with your library. Great work!

---

<div class="post-metadata">

**Author:** ![core-process](https://blenderartists.org/user_avatar/blenderartists.org/core-process/32/658318_2.png) [@core-process](https://blenderartists.org/u/core-process)\
**Post date:** [July 5, 2021, 5:35pm UTC](https://blenderartists.org/t/blazingly-fast-preview-loads-images-of-arbitrary-size-bpy-utils-previews-drop-in-replacement/1303349/14 "2021-07-05T17:35:43Z")

</div>

I just learned from @franMarz that [https://github.com/SavMartin/TexTools-Blender](https://github.com/SavMartin/TexTools-Blender) is using BIP as well! Awesome! ❤ (not released yet, but you can grab it from the master branch).

---

<div class="post-metadata">

**Author:** ![pistiwique](https://blenderartists.org/user_avatar/blenderartists.org/pistiwique/32/34144_2.png) [@pistiwique](https://blenderartists.org/u/pistiwique)\
**Post date:** [December 26, 2021, 8:16pm UTC](https://blenderartists.org/t/blazingly-fast-preview-loads-images-of-arbitrary-size-bpy-utils-previews-drop-in-replacement/1303349/15 "2021-12-26T20:16:10Z")

</div>

From what I understand, it is possible to convert an image with a .jpg, .jpeg or .png extension to .bip.  
But is it possible to save a rendered image from data.images directly to .bip ?

---

<div class="post-metadata">

**Author:** ![core-process](https://blenderartists.org/user_avatar/blenderartists.org/core-process/32/658318_2.png) [@core-process](https://blenderartists.org/u/core-process)\
**Post date:** [December 26, 2021, 8:51pm UTC](https://blenderartists.org/t/blazingly-fast-preview-loads-images-of-arbitrary-size-bpy-utils-previews-drop-in-replacement/1303349/16 "2021-12-26T20:51:35Z")

</div>

There is no direct functionality for that.

I am not 100% sure, but I believe it is possible to extract the necessary data via [https://docs.blender.org/api/current/bpy.types.Image.html#bpy.types.Image.pixels](https://docs.blender.org/api/current/bpy.types.Image.html#bpy.types.Image.pixels) and [https://docs.blender.org/api/current/bpy.types.Image.html#bpy.types.Image.size](https://docs.blender.org/api/current/bpy.types.Image.html#bpy.types.Image.size). It still needs to be converted from float to bytes (0-255) and RGBA if it isn’t RGBA yet.

The BIP format is pretty simple. See here: [https://github.com/3dninjas/3dn-bip/blob/main/bip\_converter/t3dn\_bip\_converter/convert.py#L42-L52](https://github.com/3dninjas/3dn-bip/blob/main/bip_converter/t3dn_bip_converter/convert.py#L42-L52).

@bonjorno7 or @thefauxrogue might be able to help if they have time to spare.

---

<div class="post-metadata">

**Author:** ![pistiwique](https://blenderartists.org/user_avatar/blenderartists.org/pistiwique/32/34144_2.png) [@pistiwique](https://blenderartists.org/u/pistiwique)\
**Post date:** [December 26, 2021, 10:06pm UTC](https://blenderartists.org/t/blazingly-fast-preview-loads-images-of-arbitrary-size-bpy-utils-previews-drop-in-replacement/1303349/17 "2021-12-26T22:06:42Z")

</div>

Thanks for the answer but the probleme with image from render resuilt is that the image ahs no data yet.  
So I guess the only solution is to save the rendering as a jpeg or png and then convert the image to .bip.

---

<div class="post-metadata">

**Author:** ![core-process](https://blenderartists.org/user_avatar/blenderartists.org/core-process/32/658318_2.png) [@core-process](https://blenderartists.org/u/core-process)\
**Post date:** [December 27, 2021, 12:21am UTC](https://blenderartists.org/t/blazingly-fast-preview-loads-images-of-arbitrary-size-bpy-utils-previews-drop-in-replacement/1303349/18 "2021-12-27T00:21:55Z")

</div>

If you want to avoid being dependent on Pillow, you could use [https://raw.github.com/drj11/pypng/main/code/png.py](https://raw.github.com/drj11/pypng/main/code/png.py) to read the rendered PNG and save BIP according to the format linked in my previous post. PyPNG might be slow, though. Be aware that you need to flip top to bottom, and you need premultiplied alpha ([https://github.com/3dninjas/3dn-bip/blob/main/bip\_converter/t3dn\_bip\_converter/convert.py#L33-L34](https://github.com/3dninjas/3dn-bip/blob/main/bip_converter/t3dn_bip_converter/convert.py#L33-L34)).

---

<div class="post-metadata">

**Author:** ![pistiwique](https://blenderartists.org/user_avatar/blenderartists.org/pistiwique/32/34144_2.png) [@pistiwique](https://blenderartists.org/u/pistiwique)\
**Post date:** [December 28, 2021, 5:48pm UTC](https://blenderartists.org/t/blazingly-fast-preview-loads-images-of-arbitrary-size-bpy-utils-previews-drop-in-replacement/1303349/19 "2021-12-28T17:48:56Z")

</div>

I don’t mind using Pillow at all. I even wonder why it is not part of the basic Blender modules 🤔. It’s just that I would have liked to be able to save the renders directly as .bip instead of .jpeg or .png. But it doesn’t matter, I think the user won’t see anything when generating the thumbnails.  
Anyway, nice work, it loads the images in a flash 👍.

---

<div class="post-metadata">

**Author:** ![iyadahmed](https://blenderartists.org/user_avatar/blenderartists.org/iyadahmed/32/669421_2.png) [@iyadahmed](https://blenderartists.org/u/iyadahmed)\
**Post date:** [December 30, 2021, 6:57pm UTC](https://blenderartists.org/t/blazingly-fast-preview-loads-images-of-arbitrary-size-bpy-utils-previews-drop-in-replacement/1303349/20 "2021-12-30T18:57:15Z")

</div>

Just wrote a solution for it

> <https://gist.github.com/iyadahmed/7cad21bbf286337604517fad8b17d157>

[Next page](https://blenderartists.org/t/blazingly-fast-preview-loads-images-of-arbitrary-size-bpy-utils-previews-drop-in-replacement/1303349.md?page=2)
