如何解决在查看的PDF文件中很小的栅格插入不良(evince和chrome) [英] How to fix poor interpolation of very small rasters in viewed pdfs (evince and chrome)

查看:124
本文介绍了如何解决在查看的PDF文件中很小的栅格插入不良(evince和chrome)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想为某些学术作品创建矩阵的可视化。我决定通过让图像中的像素与矩阵中的值相对应来解决这个问题。我创建了如下的漂亮的小PNG:





当适当放大时,您会得到一个非常合理的图像: https://i.stack.imgur.com/bB69Z.pngalt =在这里输入图片描述>



这是来自inkscape的屏幕截图。然而,当将它作为pdf导出时,evince和chrome在提升应该是非常微不足道的事情方面做得非常糟糕,而我得到的结果如下所示: img src =https://i.stack.imgur.com/g2TBp.pngalt =在这里输入图片描述>



pdf本身似乎可以缩放适合打印,但不幸的是,我在没有打印的情况下进行了大量编辑,这看起来不可接受。我确实发现这个令人难以置信的旧线程,关于人们似乎有类似的问题与铬的PDF浏览器,解决方案是只提高光栅图形。这是一个解决方案,但效率非常低。



是否有人知道更改pdf的方法,以便它适当地适当放大?也许在evince或chrome中更改配置会使这些配置正确?即使是从光栅图像转换为矢量图像的一个好方法可能是合适的吗? 解决方案

答案...



PDF中的图像字典有一个(可选)布尔条目插值。它被指定为一个标志,指示图像插值是否应由符合要求的读取器执行。



OP用于创建PDF的程序,Inkscape似乎已将此标志明确设置为 true 。编辑PDF以取消设置该标志会创建一个看起来与OP相同的文件。



(这也是一个在,这是保存带有嵌入的高分辨率位图的PDF文件 - >Inkscape论坛主题。 Inkscape首选项 - >位图 - >创建位图复制的分辨率,并将其设置为6000 dpi)。

插值在不同观看者和不同输出媒体中看起来不同的事实是通过设计。 PDF规范说明了插值:


符合的Reader可能选择不实现PDF的这一特性,或者可能使用任何特定的插值实现它是希望的。


解决此问题的另一种方法(尤其是某些PDF查看者倾向于不真正实现规范和例如内插忽略该标志)将在这里使用矢量图形,将位图像素绘制为矩形。结果应该是最佳的。


I want to create a visualization of a matrix for some academic work. I decided to go about this by having the pixels in the image correspond to the values in the matrix. I created the nice small png that follows:

When properly scaled up, you get a very reasonable image:

This is a screenshot from within inkscape. However, when export this as a pdf, both evince and chrome do a terrible job at upscaling what should be very trivial, and instead I get something that looks like:

The pdf itself seems to scale appropriately well for printing, but unfortunately I do a lot of my editing without printing, and this looks unacceptable. I did find this incredibly old thread about people seeming to have a similar issue with chrome's pdf viewer, and the "solution" was to just upscale the raster graphics. This is a solution, but is terribly inefficient.

Is anyone aware of a way to change the pdf so that it gets upscaled appropriately? Maybe a config change in evince or chrome that will render these properly? Even a nice way to go from a raster image to a vector image might be suitable?

解决方案

The comments aggregated into an answer...

An image dictionary in a PDF has an (optional) boolean entry Interpolate. It is specified as a flag indicating whether image interpolation shall be performed by a conforming reader.

The program used by the OP to create the PDF, Inkscape, seems to have explicitly set this flag to true. Editing the PDF to unset this flag creates a file which looks as desired by the OP.

(This also is a solution proposed in this Inkscape forum thread eventually found by the OP, which is to save the PDF with high-resolution bitmaps embedded. File -> Inkscape Preferences -> Bitmaps -> Resolution for Create Bitmap Copy, and set it to 6000 dpi)

The fact that interpolation looks different in different viewers and different output media, is by design. The PDF specification states on interpolation:

A conforming Reader may choose to not implement this feature of PDF, or may use any specific implementation of interpolation that it wishes.

A different way to get around this problem (especially as some PDF viewers have the tendency to not really live up to the specification and e.g. interpolate ignoring that flag) would be to use vector graphics here, drawing the bitmap pixels as rectangles. The result should be optimal.

这篇关于如何解决在查看的PDF文件中很小的栅格插入不良(evince和chrome)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆