1

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.

Ahsan
  • 2,964
  • 11
  • 53
  • 96
  • as I remember, that's generally how MPEG works – jcomeau_ictx Jun 04 '11 at 04:48
  • but I am talking about images, not videos... – Ahsan Jun 04 '11 at 04:49
  • 2
    a video is a sequence of images. – Mitch Wheat Jun 04 '11 at 05:15
  • The most simple way you could do this on iOS is to use the hardware h.264 encoder and render a series of images into a movie (automatically uses frame by frame deltas). It is going to be a lot harder to roll your own movie format, but if you are interested in doing that I suggest that you start with this rice entropy codec as it is already optimized for iOS: https://stackoverflow.com/a/48031300/763355 – MoDJ Nov 23 '18 at 22:34

2 Answers2

1

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.
Osman Turan
  • 1,361
  • 9
  • 12
0

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.

Justin
  • 111
  • 1
  • 9