Beispiel #1
0
    def close_img_buf(img_buf, img_file: Union[Path, None] = None):
        try:
            img_buf.clear()
            del img_buf

            if img_file:
                oiio.ImageCache().invalidate(img_file.as_posix())
        except Exception as e:
            LOGGER.error('Error closing img buf: %s', e)
Beispiel #2
0
 def shutdown(self):
     """ Release resources """
     try:
         del self.metadata_cache
         del self.manifest_cache
         self.img.clear()
         del self.img
         oiio.ImageCache().invalidate(self.img_file.as_posix())
     except Exception as e:
         LOGGER.error('Error closing img buf: %s', e)
Beispiel #3
0
def init_imagecache():
    common.oiio_cache = OpenImageIO.ImageCache(True)
    common.oiio_cache.attribute('max_memory_MB', 4096.0)
    common.oiio_cache.attribute('max_open_files', 0)
    common.oiio_cache.attribute('trust_file_extensions', 1)
    common.oiio_cache.attribute('forcefloat', 1)

    common.image_resource_list = {
        common.GuiResource: [],
        common.ThumbnailResource: [],
        common.FormatResource: [],
    }
    common.image_resource_data = {}
    common.image_cache = {
        BufferType: {},
        PixmapType: {},
        ImageType: {},
        IconType: {},
        ResourcePixmapType: {},
        ColorType: {},
    }