Click here to Skip to main content
15,920,708 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: how to change button color and how to ctivate te horizontal defilement bar of a lis Pin
a_hic26-Oct-02 4:18
a_hic26-Oct-02 4:18 
General[MFC] Calling a CFormView member function inside CMainFrm Pin
Lockness26-Oct-02 0:31
Lockness26-Oct-02 0:31 
GeneralRe: [MFC] Calling a CFormView member function inside CMainFrm Pin
dabs31-Oct-02 4:59
dabs31-Oct-02 4:59 
GeneralBmp -> JPG Pin
int01h26-Oct-02 0:14
int01h26-Oct-02 0:14 
GeneralRe: Bmp -> JPG Pin
Davide Pizzolato26-Oct-02 0:53
Davide Pizzolato26-Oct-02 0:53 
GeneralRe: Bmp -> JPG Pin
Nish Nishant26-Oct-02 1:44
sitebuilderNish Nishant26-Oct-02 1:44 
GeneralRe: Bmp -> JPG Pin
int01h26-Oct-02 4:16
int01h26-Oct-02 4:16 
GeneralRe: Bmp -> JPG Pin
Scott H. Settlemier27-Oct-02 16:26
Scott H. Settlemier27-Oct-02 16:26 
I use jpeg library a lot, it's pretty easy. Check out the docs, Google up some sample code from the many packages that use it. Here is a small sample of compressing an image to a monochrome jpeg:

(A bit of code is always good. I stripped out a lot of particulars.. mostly error handling setup. Use this example as a source of good keyword combos in Google.)

bool JPEGCompressMono(FILE* Out,int Quality,unsigned char* pSrc,int Width,int Height)
{
	struct jpeg_compress_struct cinfo;
	struct jpeg_error_mgr err; // you'll usually want to use your own error handling instead
	cinfo.err = jpeg_std_error(&err);
	jpeg_create_compress(&cinfo);
	jpeg_stdio_dest(&cinfo,Out);
	cinfo.image_width=Width;
	cinfo.image_height=Height;
	cinfo.input_components=1;
	cinfo.in_color_space=JCS_GRAYSCALE;
//	cinfo.write_JFIF_header=1; // you can add all sorts of extra info if you want
	jpeg_set_defaults(&cinfo);
	jpeg_set_quality(&cinfo,Quality,TRUE);
	jpeg_start_compress(&cinfo,TRUE);
	int Slop=(Width%4)?4-Width%4:0;
	JSAMPROW row_pointer[1];
	while (cinfo.next_scanline < cinfo.image_height)
	{
		row_pointer[0]=pSrc+(Height-1-cinfo.next_scanline)*(Width+Slop);
		jpeg_write_scanlines(&cinfo,row_pointer,1);
	}
	jpeg_finish_compress(&cinfo);
	jpeg_destroy_compress(&cinfo);
	return true;
}

GeneralRe: Bmp -> JPG Pin
int01h29-Oct-02 5:00
int01h29-Oct-02 5:00 
GeneralRe: Bmp -> JPG Pin
Scott H. Settlemier29-Oct-02 5:25
Scott H. Settlemier29-Oct-02 5:25 
GeneralRe: Bmp -> JPG Pin
nde_plume26-Oct-02 7:22
nde_plume26-Oct-02 7:22 
QuestionMFC -> Win 32?? Pin
Ayush25-Oct-02 23:12
Ayush25-Oct-02 23:12 
AnswerRe: MFC -> Win 32?? Pin
Venet26-Oct-02 1:40
Venet26-Oct-02 1:40 
GeneralRe: MFC -> Win 32?? Pin
Ayush26-Oct-02 1:46
Ayush26-Oct-02 1:46 
GeneralRe: MFC -> Win 32?? Pin
Venet26-Oct-02 2:05
Venet26-Oct-02 2:05 
AnswerRe: MFC -> Win 32?? Pin
Stephane Rodriguez.26-Oct-02 3:52
Stephane Rodriguez.26-Oct-02 3:52 
QuestionResizing two controls (splitting inside a dialog)? Pin
anonymoose25-Oct-02 22:18
anonymoose25-Oct-02 22:18 
AnswerPS: Resizing two controls (splitting inside a dialog)? Pin
Anonymous25-Oct-02 22:22
Anonymous25-Oct-02 22:22 
GeneralRe: PS: Resizing two controls (splitting inside a dialog)? Pin
anonymoose26-Oct-02 1:34
anonymoose26-Oct-02 1:34 
QuestionVS.NET UI elements -- howto? Pin
Anonymous25-Oct-02 21:13
Anonymous25-Oct-02 21:13 
GeneralRegisterd ActiveX controls Pin
Didaa25-Oct-02 20:24
Didaa25-Oct-02 20:24 
GeneralCOM interface for Image editing Pin
Neha25-Oct-02 19:26
Neha25-Oct-02 19:26 
GeneralRe: COM interface for Image editing Pin
Paul M Watt26-Oct-02 19:47
mentorPaul M Watt26-Oct-02 19:47 
Questionis there any lose of values? Pin
imran_rafique25-Oct-02 17:32
imran_rafique25-Oct-02 17:32 
AnswerRe: is there any lose of values? Pin
Michael Dunn25-Oct-02 20:31
sitebuilderMichael Dunn25-Oct-02 20:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.