Click here to Skip to main content
15,903,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Here is a question about LIBJPEG, I want to compress "org.bmp" through the compression fingerprint of "temple.jpg" (DQT, SOF, DHT and other information). That is to retain the compression method of "temple.jpg" and reconstruct "org.bmp". Can this be achieved through LIBJPEG? Thanks for answering! !

As we know , same camera manefactore will compress the image with the same way . I wanna compress image as the original picture from the camara.(Check in the hex editor)

What I have tried:

I tried to use other libraries such as Skia, libjpeg.Net (in fact, the documentation is very incomplete, and not many example ) without success.
Updated 28-Feb-23 20:22pm

1 solution

If I'm reading you right, you want to reconstruct a BMP file from a JPG?
You can't do that: you can get a visually similar file, but not the original due to the way JPG compression works.

JPG uses what's called a "lossy compression" technique: it throws a away information to get a smaller size that looks very much the same. and once that infor is discarded, it can't be recovered. It's easy to see this effect: take a BMP, convert it to JPG in a paint program.. Read the JPG into a paint program, and save it as a new JPG file. Read that, and save again. After half a dozen iterations or so, you can see the changes pretty clearly if you compare the end result with the original: it's a whole load smaller, but it's also lost clarity, fine detail, and colour.

BMP is an uncompressed format, so the same "trick" with that format doesn't cause schanges. There are "Lossless compression" formats as well: PNG for example.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900