1
我試圖創建一個遠程桌面式的程序,我目前正在試圖讓我的遠程PC上什麼圖像,背在發送到我的客戶端電腦,來更新自己的形象(這種情況發生過2-3秒)。傳遞位圖/ JPEG通過網絡
我目前拿到桌面的圖像是這樣的:
// Set up a bitmap of the correct size
Bitmap CapturedImage = new Bitmap((int)SystemInformation.VirtualScreen.Width,
(int)SystemInformation.VirtualScreen.Height, System.Drawing.Imaging.PixelFormat.Format16bppRgb565);
// Create a graphics object from it
System.Drawing.Size size = new System.Drawing.Size((int)SystemInformation.VirtualScreen.Width, (int)SystemInformation.VirtualScreen.Height);
using (Graphics gr = Graphics.FromImage(CapturedImage))
{
// copy the entire screen to the bitmap
gr.CopyFromScreen(0, 0, 0, 0,
size, CopyPixelOperation.SourceCopy);
}
EncodeToJPEG(CapturedImage);
而且EncodeToJPEG看起來是這樣的:
var qualityEncoder = Encoder.Quality;
var quality = (long)0;
var ratio = new EncoderParameter(qualityEncoder, quality);
var codecParams = new EncoderParameters(1);
codecParams.Param[0] = ratio;
var jpegCodecInfo = GetEncoder(ImageFormat.Jpeg);
capturedImage.Save(@"c:\Test.jpg", jpegCodecInfo, codecParams); // Save to JPG
我的問題來自於保存 方法。我想知道是否有一種方法可以臨時存儲這張JPG,只要我能夠通過網絡發回,而不是將其保存到文件中?像,我可以返回一個壓縮的JPG圖像對象嗎?或者這是不可能的這種方式?
我也聽說了這些目的,將圖像分割成塊,並檢查他們的三角洲,只發回的變化更快,更新這樣的圖像的最有效方法。如果任何人有任何在該部門的指針,我會非常感激。