如何通过打印功能将图形打印到剪贴板,其质量与“编辑-->复制图形”相同选项?

发布于 2024-10-07 10:58:08 字数 911 浏览 6 评论 0原文

有没有什么方法可以将图形打印到剪贴板,以便其质量与编辑-->复制图形选项提供的质量相同?

我曾经使用从 Matlab Central 获得的 saveppt.m 将图形保存到 powerpoint 文件。直到昨天为止效果都很好。我注意到存储的图像质量有所下降。我尝试使用完全相同的脚本和相同的源数据重新生成一些 ppt 幻灯片,但新幻灯片的质量较差。

我对这个问题进行了一些调查,发现当通过运行 print -dmeta 将图形复制到剪贴板时,剪贴板中的图像已经降级,而如果我使用 Edit- ->图形窗口中的复制图形选项,我在图形窗口中得到的图像与原始图像一样清晰。

以下是一个示例供您参考。我通过两种不同的方法将图形中的图像复制到剪贴板,然后将其粘贴到 Microsoft Paint 程序中,并剪切一部分如下所示:

使用 print -dmeta 的图像:使用“print -dmeta”存储的图形

使用编辑-->复制图形的图像:使用“复制图”存储的图

如果您比较 Xtick 标签“50”,您可能会看到来自 的图像编辑-->复制图更流畅。

一开始我以为是分辨率的问题,但是设置-rN来改变分辨率似乎并不能解决我的问题,至少对于N<=300来说是这样。

感谢您的帮助。

Is there any way to print the figure to the clipboard so that the quality is identical to what the Edit-->Copy Figure option provides?

I used to save the figure to powerpoint file by using saveppt.m obtained from Matlab Central. It worked well until yesterday. I noticed that the stored image quality was somehow degraded. I tried to re-generate some ppt slides with exactly the same script and the same source data, but the new slides are simply of worse quality.

I investigated into this problem a little bit and discovered that when the figure is copied to clipboard by running print -dmeta, the image in the clipboard is already degraded, while if I use the Edit-->Copy Figure option in the figure window, I get the image as clear as the original image in the figure window.

Following is an example for your reference. I copied the image from a figure to the clipboard by two different methods, and paste it to Microsoft Paint program, and cut a piece of it to show below:

The image using print -dmeta: stored figure using "print -dmeta"

The image using Edit-->Copy Figure: stored figure using "Copy Figure"

If you compare the Xtick label '50', you may see that the image from Edit-->Copy Figure is smoother.

At the beginning I thought it was a problem of the resolution, but setting -rN to change the resolution does not seem to resolve my problem, at least not for N<=300.

Thank you for your help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

墨落成白 2024-10-14 10:58:08

简短的答案... 使用在该菜单项的回调中调用的相同函数:

editmenufcn(gcf,'EditCopyFigure');

较长的答案... 我到底是如何找到这个的?您可以查看 我之前对 有关重现“文件”菜单选项所做操作的相关问题。概念是一样的,只是图形菜单不同。例如,这将为当前活动的图形窗口找到所需的回调:

>> hCopyFigure = findall(gcf,'Label','Copy &Figure');  %# Handle for the "Copy
                                                       %#   Figure" menu item
>> get(hCopyFigure,'Callback')  %# Callback invoked when that item is selected

ans =

editmenufcn(gcbf,'EditCopyFigure')

函数 EDITMENUFCN 是另一个稀疏记录的函数,但浏览代码(通过输入 edit editmenufcn.m)显示它要么调用 Java(如果您使用的是 Mac),要么调用未记录的函数 UIMENUFCN。

The short answer... Use the same function invoked in the callback for that menu item:

editmenufcn(gcf,'EditCopyFigure');

The longer answer... How exactly did I find this? You can look at my previous answer to a related question about reproducing what is done by a File menu option. The concept is the same, just for a different figure menu. For example, this will find the callback you want for the currently active figure window:

>> hCopyFigure = findall(gcf,'Label','Copy &Figure');  %# Handle for the "Copy
                                                       %#   Figure" menu item
>> get(hCopyFigure,'Callback')  %# Callback invoked when that item is selected

ans =

editmenufcn(gcbf,'EditCopyFigure')

The function EDITMENUFCN is another one of those sparsely documented functions, but looking through the code (by typing edit editmenufcn.m) shows that it either invokes Java (if you're on a Mac) or the undocumented function UIMENUFCN.

浪荡不羁 2024-10-14 10:58:08

我想我自己找到了答案。使用 print -dmeta -painters 指定渲染器解决了我的问题。

文件-->首选项-->图形复制模板-->复制选项中,我注意到有3个选项:

  1. 图元文件
  2. 保留信息
  3. 位图

我发现如果我选择1,编辑-->复制图输出与print -dmeta相同的图像。所以我确认了我需要的信息位于保留信息选项中。快速的谷歌搜索让我讨论了所应用的渲染器的潜在差异,最终我确认使用painters会按照我想要的方式将图像打印到剪贴板。

问题中的图像似乎分别由渲染器 zbufferpainters 生成。不过,我仍然不知道为什么 paint -dmeta 的默认渲染器会发生变化。

I think I found the answer myself. Using print -dmeta -painters to specify the renderer resolves my problem.

In File-->Preference-->Figure Copy Template-->Copy Option I noticed there are 3 options:

  1. Metafile
  2. Preserve information
  3. Bitmap

I found that if I select 1, the Edit-->Copy Figure outputs the same image as print -dmeta. So I kind of confirmed the information I need is in the Preserve information option. A quick google search led me to the discussion about the potential difference of the applied renderer, and eventually I confirmed that using painters will print the image to the clipboard in the way I wanted.

The image in the question seems to be generated by the renderer zbuffer and painters, respectively. I still don't know why the default renderer of paint -dmeta changes, though.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文