本文介绍了将面板另存为图像:图片不清晰,某些区域出现灰点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

首先,让我向您展示我已经拥有的.这可能会帮助想知道的人,如何轻松地将面板另存为图像.

就我而言,我将带有透明标签的图片另存为图像(bmp/jpg).
该图像来自其他窗口,我在其中使用SampleGrabber抓取帧并将其保存到我的硬盘中("C:\\ example.bmp").标签显示了计算机的当前时间.

Hello,

firstly let me show you what I already have. This might help somebody who want to know, how to save a panel as an image easily.

In my case, I save a picture with a transparent label over it as an image (bmp/jpg).
The image comes from other windows , where i used SampleGrabber to grab frames and save them to my harddisc ("C:\\example.bmp"). The label shows the current time of the computer.

label1->Text = Convert::ToString(System::DateTime::Now);
panel1->BackgroundImage = Image::FromFile("C:\\example.bmp");
// loading picture on BackgroundImage allows us to make the label text with a transparent back color(label property-> Back color -> Transparent)

// you can also make a pictureBox on the panel and load Foto on the pictureBox,
// But in this case you have to lay the label separately to the pictureBox on the panel in order to get it showed. Which means, you couldn't make the transparent label overlap the image, as I tried.
System::Drawing::Rectangle rc = panel1->ClientRectangle;
Bitmap^ bmp= gcnew Bitmap(rc.Width, rc.Height);
this->panel1->DrawToBitmap(bmp, rc);

bmp->Save("C:\\ExampleJPG.jpg");
bmp->Save("C:\\ExampleBMP.bmp");



C ++/CLI的处置方法:



Dispose method for C++/CLI:

if (panel1->BackgroundImage!=nullptr)
    delete panel1->BackgroundImage;



好的,现在是我的问题了:
1.最大的问题是保存图片的质量.我可以成功保存图片.但我总是在它们上出现一些灰色点("C:\\ ExampleJPG.jpg"或"C:\\ ExampleBMP.bmp").有时很多,有时只有三个或四个点,有时则没有这样的东西.我不明白为什么.那我应该更正照片吗?还是什么?
你能给我建议吗?

2.另一个问题:如何更改图片的分辨率? (在保存之前或之后.)



OK, now time for my problem:
1. the biggest problem is the quality of saved pictures. I can succesfully save the pictures. But I always get some gray points on them ("C:\\ExampleJPG.jpg" or "C:\\ExampleBMP.bmp"). Sometimes a lot, sometimes only three or four dots, sometimes there is no such things. I don''t understand why. So should I make foto corrections? Or what else?
Could you give me advices?

2. another question: How can I change the resolution of the pictures? (Before or after they are saved.)

Any answer will be appreciated!

推荐答案


这篇关于将面板另存为图像:图片不清晰,某些区域出现灰点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-16 17:58
查看更多