简体   繁体   English

如何压缩一批图像?

[英]How can I compress a batch of images?

We are constantly transferring gigabytes of compressed Tiffs overseas and it takes a long time for each batch of images to transfer. 我们一直在不断向海外传输千兆字节的压缩Tiff,并且每批图像传输都需要很长时间。 It is not uncommon for a batch to take over 6 hours to transfer. 一批要花6个小时以上才能转移。 I would like to reduce the time to transfer a batch of images. 我想减少传输一批图像的时间。

I understand that videos compress really well because most of the time each frame is generally very similar to the one before it and compression algorithms take advantage of that. 我了解视频的压缩效果非常好,因为大多数情况下,每个帧的时间通常与之前的帧非常相似,并且压缩算法会利用这一点。 In our scenario, the images often look similar to one another. 在我们的方案中,图像通常看起来彼此相似。 Are there any image compression libraries I can use to take advantage of the fact that there is a lot of redundancy across images? 我是否可以使用任何图像压缩库来利用图像之间存在大量冗余的事实? Ideally I would want lossless compression. 理想情况下,我需要无损压缩。

Would it work if I turned the images into a video before transferring them and then turned them back to images on the other side? 如果在传输图像之前将图像转换为视频然后再将其转换为另一侧的图像,是否可以使用? If this would work, what libraries would you recommend? 如果可行,您会推荐哪些库? I need to be able to call this from Java and preferably run it on Linux, but the library does not need to be written in Java. 我需要能够从Java调用它,最好在Linux上运行它,但是该库不需要用Java编写。 Windows could also be a possibility. Windows也有可能。

What I would try first: 我首先要尝试的是:

Start from uncompressed tiffs (otherwise, it will be hard to find similarities). 从未uncompressed tiff开始(否则,将很难找到相似之处)。

tar them together (so they are contained within a single file, can be a specific range of images off course). tar它们一起tar (因此它们包含在单个文件中,可能是偏离范围的特定图像范围)。

Then use a compression algorithm of your choice to see which one yields the best results (on the single file). 然后使用您选择的压缩算法来查看哪种压缩算法产生最佳效果(在单个文件上)。

Easy enough to try out without much effort. 很容易尝试,无需太多努力。 How well it works depends on the source images themselves (and the compression algorithm used). 其效果如何取决于源图像本身(以及使用的压缩算法)。

Alternative approach if the above does not yield enough results: 如果上述方法未产生足够的结果,请使用替代方法:

  1. Make sure you have all uncompressed images. 确保您拥有所有未压缩的图像。

  2. Send over the first image. 发送第一张图片。

  3. Do a binary diff (or maybe diffing the hexdump) towards the next image. 对下一个图像进行binary diff (或将十六binary diff转储)。

  4. Send over the diff file and apply it at the receiving end to reconstruct the image. 通过diff文件发送并在接收端应用它以重建图像。

  5. Repeat 3-4 for every image. 对每个图像重复3-4。

I personally don't think you will easily get good (lossless) results by using video compression algorithms (after all, they are specifically tailored to a different purpose). 我个人认为使用视频压缩算法不会轻易获得良好(无损)结果(毕竟,它们是专门为不同目的量身定制的)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM