Hi,
Dan Hitt wrote:
> Thomas, that sounds awesome, please do post somewhere (and provide a link
> here, if you would be so kind).
So on popular demand by one potential user here it is
http://scdbackup.sourceforge.net/halve_jpeg.c
SHA256SUM:
b4c9322cd7d20a09a5196ccbcec257bf363d9dea1284333afc9624ff6a05dcc0
It needs installed libjpeg development header files and runtime library.
To my theory that would be package "libjpeg62-turbo-dev" which brings
the runtime as dependency.
The tools for compilation get installed by meta-package "build-essential".
Compile the program by
cc -g -Wall -o halve_jpeg halve_jpeg.c -ljpeg
Test by converting some file
./halve_jpeg -geometry 1280x1024 large_input_pic.jpg ermerging_small_pic.jpg
xv ermerging_small_pic.jpg
The -geometry argument defines a frame into which ermerging_small_pic.jpg
will fit while retaining its x:y ratio.
For permanent use, copy the file ./halve_jpeg to a directory where the shell
will find it.
It is not very good with enlarging images. My motivation was to condense
JPEGS with zillions of pixels to screen size without blasting my RAM which
was only 2 GB at that time.
Have a nice day :)
Thomas
Thanks Thomas for posting it.
On xubuntu 20.2 i was able to compile it after installing some jpeg packages:
sudo apt-get install jpeginfo libjpeg-dev libjpeg-progs libjpeg-tools
I think some of these names may be generic and point to the turbo code, i'm not sure. I tried just installing all jpeg packages but got conflicts, so i pared down the list until i could install.
The code compiled quickly.
It was unwilling to deal with a non-color image that i had ("Unsuitable JPEG format with 1 components per pixel"), but on color images it works and is very fast. And since you were so nice to provide the source code, if i need to deal with non-color images, i can try to modify it.
Thanks again!
dan