Copyright notice: When reprinted, please indicate the original source and author information of the article by hyperlink form and this statement
Http://chenet.blogbus.com/logs/28263560.html
Recently on Remote Desktop, you need to transfer pictures between the server and the client. As a direct screenshot of the BMP format, the picture is very large, so you need to compress it into a JPG format transmission. It took a long time to find a way to call an external library (JpgDll.dll) on the Internet. But it often goes wrong when used.
Later, people remind, only know that there is cimage this class.
Examples of CImage classes in MSDN2005:
Ms-help://ms. Vscc.v80/ms. Msdn.v80/ms. Visualstudio.v80.chs/dv_vcsample/html/4b6a0e30-5e37-4ef2-ae84-061540fa80e2.htm
use this class to first add #include <atlimage.h> to the stdafx.h.
save bmp as JPG:
CImage image;
Image. Load (TEXT ("e://images//1.bmp")); Load picture
Image. Save (TEXT ("e://images//1.jpg")); Save as Picture
show jpg:
CImage image;
CRect Zcrect;
GetClientRect (&zcrect);
Image. Load (TEXT ("e://images//1.jpg"));
Image. Draw (GetDC ()->m_hdc,zcrect.left,zcrect.top,zcrect.width (), Zcrect.height ());//Show Picture
Other similarities.