Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't delete live/motion photos data #158

Open
TheLastGimbus opened this issue Sep 7, 2023 · 2 comments
Open

Don't delete live/motion photos data #158

TheLastGimbus opened this issue Sep 7, 2023 · 2 comments

Comments

@TheLastGimbus
Copy link

Hi! As my photo gallery has grown to 40GB, i wanted to finally run jpegoptim over it to shrink it just a bit

Took a random photo, and results were good... 3.2mb -> 1.4mb .... too good...

I realised that many of my photos have live/motion data... and I want this! But jpegoptim seems to strip it away

Here is an example:

PXL_20230604_135646407 MP

Try to download it and view it in Google Photos (i hope github doesn't compress this), and then do same after jpegoptim (desktop-web https://photos.google.com will also work!)

Please make it not strip it away 🙏

@tjko
Copy link
Owner

tjko commented Sep 9, 2023

Seems like this live/motion data is simply added at the end of the JPEG image, and not part of the image.

$ ./jpegoptim -v -v -n test.jpg 
Using maximum of 1 parallel threads
processing file: test.jpg
test.jpg 5 markers found in input file (total size 51146 bytes)
coding: Huffman
1944x2592 24bit N Exif,XMP,XMP,JFIF,ICC (1849570 bytes extraneous data found after end of image)  [OK] 3242210 --> 1370488 bytes (57.73%), optimized.

jpegoptim 'decodes' the JPEG file and then rebuilds in from scratch, so extra data added after the end of the image will be "lost".
There is --nofix option that will cause jpegoptim to skip processing images like this, but currently there is no way to 'optimize' image and preserve data that is not part of the actual JPEG image.

I supposed it would be possible to add option to tell jpegoptim to preserve any "extraneous" data after end of the JPEG image in the input file...

@wwinniww
Copy link

wwinniww commented Sep 9, 2023

I guess the new Ultra HDR Image format form Google is the next candidate,
it's basically a JPEG image with extensions.
It looks like a normal JPEG file and use the JPG file extension by default.

The extentional HDR data will be lost after the optimisation processing done by jpegoptim, because the additional data does not conform to the original JPEG specifications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants