c++ - Read image file, for compression -


so trying out c++, , start something, , guess, compressing images should simple.

and code is:

void main(){     struct jpeg_compress_struct cinfo;     struct jpeg_error_mgr jerr;     cinfo.err = jpeg_std_error(&jerr);     jpeg_create_compress(&cinfo);     file* outfile = fopen("/tmp/test.jpeg", "wb");     jpeg_stdio_dest(&cinfo, outfile);      //cinfo.image_width      = xinfo.width;     //cinfo.image_height     = xinfo.height;     //cinfo.input_components = 3;     //cinfo.in_color_space   = jcs_rgb;      jpeg_set_defaults(&cinfo);     /*set quality [0..100]  */     jpeg_set_quality (&cinfo, 75, true);     jpeg_start_compress(&cinfo, true);     jpeg_finish_compress(&cinfo); } 

which took , changed bit form site.

though can see, xinfo doesn´t exist, , in example found, screenshot library or something.

so want feed image got on harddrive , compress it. don´t want make harder necessary.

http://www.andrewewhite.net/wordpress/2008/09/02/very-simple-jpeg-writer-in-c-c/


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -