On Sun, May 23, 2021 at 1:23 PM Thomas Schmitt <scdbac...@gmx.net> wrote:
> Hi, > > i wrote: > > > halve_jpeg.c > > Dan Hitt wrote: > > It was unwilling to deal with a non-color image that i had ("Unsuitable > JPEG > > format with 1 components per pixel"), [...] > > if i need to deal with non-color images, i can try to modify it. > > It is much ad-hoc work, i have to confess. The images which made my > computer > mad came from a professional camera and all were in 3 colors. > > Every occurence of 3 between "2013" and "if(argc < 3)" would have to > become hjpg->cinfo_in.output_components. > > Next problem is the hardcoded > cinfo_out->in_color_space= JCS_RGB; > which must become hjpg->cinfo_in.out_color_space. > > Another need for change might come from the program's habit to size down > to half edge length by default. > (Originally this was its only mode because it was only intended to make > the image size digestible for ImageMagick "convert". Then i got carried > away and implemented more flexible scaling.) > > ------------------------------------------------------------------------- > > I forked a new program reformat_jpeg.c and implemented those changes. > It seems to work with grayscale > > https://upload.wikimedia.org/wikipedia/commons/thumb/e/ee/Nine_steps_stair_in_Lysekil_-_bw.jpg/800px-Nine_steps_stair_in_Lysekil_-_bw.jpg > and with the color images i tested up to now. > (Ye olde halve_jpeg got lots of testing during the years.) > > Download: > http://scdbackup.sourceforge.net/reformat_jpeg.c > (if sourceforge gets over its 503 and 504 errors of today) > SHA256: > 64ab46e8102e304558f0a10c85cc2dd08010d4346c50ab4eca678049d2b9c260 > > Compilation: > cc -g -Wall -o reformat_jpeg reformat_jpeg.c -ljpeg > > Usage is like with halve_jpeg, except the size default. > > > Have a nice day :) > > Thomas > > Thanks Thomas! The reformat_jpeg program compiles and runs quickly, and also deals with my non-color images (which i visually checked with qiv). Thank you so much for sharing the fruit of your labor! :) dan