io_mesh_uv_layout: speed up png export with OIIO (x7)
commit59adfc0979aaf940e47a28ff7a196881fc019668
authorOxicid <oxicid@noreply.localhost>
Thu, 13 Apr 2023 03:51:43 +0000 (13 05:51 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 13 Apr 2023 10:25:42 +0000 (13 20:25 +1000)
tree4f0b01936a94e924fc4d0d8aeffa8148350be2a0
parent23e0ab6d20b9946df29752f36e4803d5969f196c
io_mesh_uv_layout: speed up png export with OIIO (x7)

Since png eventually stores data in int8 type, when using bpy to save an
image, you actually have to convert the types twice, first to float and
then back to int8.

Using library OIIO allows you to avoid such conversions, as directly
with int8, thereby speed of the whole operation increases in 7 times.

Also, OIIO is more correct in premultiplied alpha, now the texture is
not darkened.

Ref !104545 with minor updates by @ideasman42.
io_mesh_uv_layout/__init__.py
io_mesh_uv_layout/export_uv_png.py