java图像压缩并减少字节大小
我最近开发了一个海量文件上传加载器(一个swing应用程序)。新的要求之一是支持上传数千个文档(GIF,JPG,PNG,DOCX,XLSX),每个文件的大小约为3MB-10MB,我们不想上传这些大文件,我们通常支持 TIFF 文件,其字节大小较小,如 60KB-100KB。我们不关心图像质量,我们只需要上传这些文档以供将来参考。现在我不知道如何解决这个问题,我开始研究它。请指出我正确的方向。
-PD
I developed a mass file up loader (a swing application) recently.One of the new requirements is to support uploading thousands of documents (GIF,JPG,PNG,DOCX,XLSX), each of these are like 3MB-10MB of size and we don't want to upload these huge files, we generally support TIFF files which has small byte size like 60KB-100KB. We are not concerned about the image quality, all we need to upload these docs for future reference. Right now I don't have any idea how to solve this problem, I started researching it. Please point me in right direction.
-PD
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的第一个方法是将它们转换为 pdf 文件。所有可以打印的内容都可以转换为 pdf。这也允许图像压缩。我认为 Tiff 对于 doc/xls 来说不是一个好主意,它可能会使它们更大。
My first approach would be to convert them to pdf files. Everything that can be printed can be converted to pdf. This also allows for image compression. Tiff won't be a good idea for doc/xls I think, it might make them bigger.
可以非常快速地对 .doc 或 .xlsx 进行 gzip 压缩,从而节省大量成本。
图像风险更大,取决于数据是什么。人的照片?图片文字?
a .doc or .xlsx can be gzipped very quickly for decent savings.
Images are more risky, depends on what the data is. Pictures of people? Pictures of text?