将图像存储在Python中的最有效方法?

发布于 2025-01-26 16:16:00 字数 233 浏览 2 评论 0原文

我目前正在Python中的Image Server项目工作,但我无法找到有关将图像存储在内存中的最有效方法的信息。我已经尝试使用sys.getSizeof尝试将对象的大小获取内存中的大小,但是它不会返回Numpy数组或PIL图像的准确大小。我还考虑过将所有python模块一起绕开,并将图像存储在tmpfs ramdisk中,并在请求图像时将它们加载回。我感谢对这个问题的最佳实践的任何见解。

I'm currently working on a image server project in Python and I've been unable to find information on the most efficient way of storing the images in memory. I've tried using sys.getsizeof to try to get the size of the object in memory, but it doesn't return an accurate size for numpy arrays or PIL images. I've also thought about bypassing Python modules all together and storing the images in a tmpfs ramdisk and loading them back in when the images are requested. I'd appreciate any insights into the best practices for this problem.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文