mirror of
https://github.com/9001/copyparty.git
synced 2026-02-27 05:53:11 -07:00
th: hack: configure pyvips cache and invalidate images
Attempt to reduce memory usage.
This commit is contained in:
parent
6e82434e58
commit
4dc100ad3f
|
|
@ -186,6 +186,7 @@ try:
|
||||||
HAVE_VIPS = True
|
HAVE_VIPS = True
|
||||||
import pyvips
|
import pyvips
|
||||||
|
|
||||||
|
pyvips.cache_set_max(0)
|
||||||
logging.getLogger("pyvips").setLevel(logging.WARNING)
|
logging.getLogger("pyvips").setLevel(logging.WARNING)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
HAVE_VIPS = False
|
HAVE_VIPS = False
|
||||||
|
|
@ -694,6 +695,7 @@ class ThumbSrv(object):
|
||||||
qv = VIPS_JPG_Q[qv // 5]
|
qv = VIPS_JPG_Q[qv // 5]
|
||||||
args["optimize_coding"] = True
|
args["optimize_coding"] = True
|
||||||
img.write_to_file(tpath, Q=qv, strip=True, **args)
|
img.write_to_file(tpath, Q=qv, strip=True, **args)
|
||||||
|
img.invalidate()
|
||||||
|
|
||||||
def conv_raw(self, abspath: str, tpath: str, fmt: str, vn: VFS) -> None:
|
def conv_raw(self, abspath: str, tpath: str, fmt: str, vn: VFS) -> None:
|
||||||
self.wait4ram(0.2, tpath)
|
self.wait4ram(0.2, tpath)
|
||||||
|
|
@ -733,6 +735,7 @@ class ThumbSrv(object):
|
||||||
qv = VIPS_JPG_Q[qv // 5]
|
qv = VIPS_JPG_Q[qv // 5]
|
||||||
args["optimize_coding"] = True
|
args["optimize_coding"] = True
|
||||||
img.write_to_file(tpath, Q=qv, strip=True, **args)
|
img.write_to_file(tpath, Q=qv, strip=True, **args)
|
||||||
|
img.invalidate()
|
||||||
elif HAVE_PIL:
|
elif HAVE_PIL:
|
||||||
if thumb.format == rawpy.ThumbFormat.BITMAP:
|
if thumb.format == rawpy.ThumbFormat.BITMAP:
|
||||||
im = Image.fromarray(thumb.data, "RGB")
|
im = Image.fromarray(thumb.data, "RGB")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue