I am using fswebcam. It is able to write both raw frame as well as processed frame. It is a great tool able putting text (e.g. timestamps) onto the image, but I am facing quality issues, actually not directly related to this tool, but to the "theory" in general.
It appears that camera gives raw image in JPEG format, and I can't control the quality of image. Let's say, camera returns quality 76. I run fswebcam without special tuning, and it returns image with quality of 100. File size inflates. Of course, I can set up quality in arguments to fswebcam, but to do it I first need to know raw file quality, for that magick identify seems to be the right tool.
And I must check raw file every time because it was witnessed that camera may select quality level on its own for every capture.
I have read that repacking JPEG image with higher quality does not make sense. I can't figure out if just repacking the image with the same quality, after text by fswebcam is added, penalizes the quality of image.
And what I have seen is repacking the image even with the same quality adds artefacts. Therefore, to keep the quality of image and have the text on the image (actually at the bottom of the image):
(a) keep the camera's raw JPEG image intact and add the text some other way - I tried putting another image between SOI and EOI with no outcome, have idea of overlaying two images, transparent png with text above the jpeg (e.g. using CSS). This is overkill...
(b) somehow have proven way to repack the original camera's JPEG file with text embedded, with minimal or no artefacts in the areas not covered by/away from the text. And have it working using any genetic libraries. Like unpack raw JPEG to 24-bit BMP having original data, then add the text, and then repack.
There're two goals at the end: (1) have same quality of JPEG with text added (2) with comparable size.
Any advice, experience, with facts, will be appreciated! Thanks!