开发者

about image compression

I have this question about image开发者_如何转开发 compression:

can we compress a series of images such that the next image will only contain the changes from the previous image and so on and so forth ? I was looking for something on the iOS and PC.

any ideas ? (in other words, whats the best way to compress photos for iOS ?)

Thanks.


I understand from the question that you meant every single images have exactly same resolution. If so, consider this algorithm:

  1. Divide every images into fixed blocks (say 8x8).
  2. For each block, compare it with previous image's block. Comparison can be pixel-perfect or lossy.
  3. Encode a flag to indicate block equality (or similarity).
  4. If there is a mismatch, output that block.

If you have enough room in mobile environment, you can further improve compression by implementing these features:

  1. Use a proper bit-wise range coder as entropy coder.
  2. Build a model to handle pixel neighbor-hood. As a naive approach, you can have a look at PNG's filters.
  3. Use quad-tree or similar structures to implement adaptive block size.
  4. DO NOT try to model low-bits. They are highly incompressible.


Give the image some bash love.

"sips -s formatOptions 60 image/path" for image/path, you can also just drag the image in.

you can also try to resize the image to save speed

"sips -Z 800 image/path"

this code will keep the aspect ratio

if you want to select all jpg you can write it like this

"sips -Z 800 *.jpg"

its case sensitive so you check if its jpg or JPG.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜