FLIF-hub / FLIF

Free Lossless Image Format
Other
3.72k stars 229 forks source link

Can I convert the FLIF image to jpeg losslessly? #544

Open stephane-archer opened 5 years ago

stephane-archer commented 5 years ago

If FLIF is lossless it means that the image will be exactly the same as my jpeg right? But Can I convert the FLIF image to jpeg losslessly?

bjorn3 commented 5 years ago

Even converting jpeg to jpeg would likely cause differences in results. There are multiple ways to encode the same image data and you will have to convince the jpeg writer to not so anything lossless. Converting between FLIF and another lossless file format, for example png, would not change the image data, but those also have multiple ways to encode the same data.

Also be aware that development of FLIF has basically stopped. The last comment was 1 year ago. And several memory corruption bugs remain unfixed. For example https://github.com/FLIF-hub/FLIF/issues/541.

stephane-archer commented 5 years ago

Thank you for this great explanation. I'm looking for something to compress my JPEG (photos from camera) losslessly. So I can store them with less space but I don't want to sacrifice the quality of these memories. Do you think FLIF is good in that case? Do you have any other recommendations?

On Tue, Oct 29, 2019, 23:48 bjorn3 notifications@github.com wrote:

Even converting jpeg to jpeg would likely cause differences in results. There are multiple ways to encode the same image data and you will have to convince the jpeg writer to not so anything lossless. Converting between FLIF and another lossless file format, for example png, would not change the image data, but those also have multiple ways to encode the same data.

Also be aware that development of FLIF has basically stopped. The last comment was 1 year ago. And several memory corruption bugs remain unfixed. For example #541 https://github.com/FLIF-hub/FLIF/issues/541.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/FLIF-hub/FLIF/issues/544?email_source=notifications&email_token=AAWX4PLNGBYY4R5DV2UNKZDQRBEL7A5CNFSM4JGJTGD2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECQYV7A#issuecomment-547457788, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAWX4PNRTUEF63UGCLN5HOTQRBEL7ANCNFSM4JGJTGDQ .

zigazeljko commented 5 years ago

If your photos are already in JPEG format, I doubt that FLIF would compress them any better.

You should probably check out Lepton (https://github.com/dropbox/lepton), which is made specifically for such cases (losslessly recompressing pre-existing JPEG files).

Two-Tone commented 4 years ago

I've actually transcoded a number of jpg compressed images into flif images and for most of them the flif re-encode was a few percents smaller than the original jpg.

cherrysnower commented 4 years ago

what is the compression rate between the jpeg file the the flif file

cherrysnower commented 4 years ago

I've actually transcoded a number of jpg compressed images into flif images and for most of them the flif re-encode was a few percents smaller than the original jpg.

May I ask what is the compression rate between the jpeg file and the flif file ? Another question is how can the FLIF project support the jpeg input?

Two-Tone commented 4 years ago

I wanna say it was between 3-5% smaller on average? This was many months ago, though, so I can't give actual numbers, just share some slightly vague memories

Another question is how can the FLIF project support the jpeg input?

This Github is just a reference encoder/decoder for the format. I had used ImageMagick to do the conversion.

ziemek99 commented 2 years ago

Even converting jpeg to jpeg would likely cause differences in results. There are multiple ways to encode the same image data and you will have to convince the jpeg writer to not so anything lossless. Converting between FLIF and another lossless file format, for example png, would not change the image data, but those also have multiple ways to encode the same data.

Also be aware that development of FLIF has basically stopped. The last comment was 1 year ago. And several memory corruption bugs remain unfixed. For example #541.

@bjorn3 you're right about differences in results and you're right about development being stopped. FLIF was extended to FUIF, which became part of JPEG XL. You can read more about JPEG XL on an official website, community website, dig into GitHub repository or join Jon, other JPEG XL devs and the community on a Discord server.

I've actually transcoded a number of jpg compressed images into flif images and for most of them the flif re-encode was a few percents smaller than the original jpg.

@Two-Tone JPEG XL has a unique feature that allows re-encoding JPEG to smaller files without changing the data, i.e. resulting JPEG XL file can be bit-exactly decoded back to source JPEG. Similar functionality was meant to be included in FLIF (see #209), but then JPEG XL happened and FLIF's development stopped.

If you decoded your JPEGs, re-encoded them losslessly with FLIF and then removed the originals immediately:

I genuinely hope you still have your original JPEG files...