适合ghostscript中的页面大小

适合ghostscript中的页面大小

本文介绍了适合ghostscript中的页面大小(输入可能已损坏)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用ghostscript将.ps文件转换为一系列.png文件,主要是因为我没有可容忍的ps查看器。

I'm trying to use ghostscript to convert a .ps file to a series of .png files, largely because I don't have a tolerable ps viewer.

这是我使用的命令:

gs -dBATCH -dEPSCrop -dEPSFitPage -sDEVICE=png16m -r300  -dNOPAUSE -sOutputFile=neptune_111115_ob1-2_13pca_boloplots_%d.png neptune_111115_ob1-2_13pca_boloplots.ps

(。ps文件是一个

输出部分不在页面上。我希望这些图像适合页面内。

The outputs are partly off the page. I'd like the images to fit inside the page.

我可以包含示例文件,但是它们很大-在.ps文件中是否有任何特定部分

I can include example files, but they're pretty large - is there any particular part of the .ps file that would be helpful?

我的怀疑是.ps文件未正确指定边界框,但是修改BB值没有任何效果。 .ps文件由IDL(ittvis的交互式数据语言)编写。我也尝试了上面的命令,但没有使用-dEPS *命令,但是没有运气。

My suspicion is that the .ps file is specifying the bounding box incorrectly, but hacking the BB values didn't have any effect. The .ps file is written by IDL (ittvis' Interactive Data Language). I've also tried the above command without the -dEPS* commands without luck.

推荐答案

-dEPSCrop -dEPSFitPage 是互斥的:


  • 一个

  • 另一个将PS中指定的 %% BoundingBox 中的EPS放大。文件的内部注释以适合当前媒体。

  • One crops the EPS to the BoundingBox specified in the comments.
  • The other scales up the EPS from the %%BoundingBox specified in the PS file's internal comments to fit the current media.

您不能同时使用两者。

该文件无论如何都不能是EPS文件,因为EPS文件中不能有多个页面。因此实际上这两个开关都不会产生任何作用(如您所发现的)。

The file can't be an EPS file anyway, because you can't have multiple pages in an EPS file. So actually neither switch will have any effect (as you've discovered).

PostScript都使用 setpage setpagedevice ,或者它仅使用当前设置的媒体。我的猜测是它仅使用当前的媒体。尝试设置 -sPAPERSIZE = a4 -sPAPERSIZE =字母

Either the PostScript requests a media size using setpage or setpagedevice, or it just uses whatever the currently set media is. My guess is that its just using the current media. Try setting -sPAPERSIZE=a4 and -sPAPERSIZE=letter.

如果可以,则程序不要求媒体大小。如果没有效果,则另外设置 -dFIXEDMEDIA ,它将忽略后续更改媒体大小的请求。

If that works then the program does not request a media size. If it has no effect, then set -dFIXEDMEDIA in addition which will ignore subsequent requests to change the media size.

这应该允许您指定正确的介质大小,如果您不知道应该使用什么介质大小,则可以使用Ghostscript -sDEVICE = bbox 设备查找

That should allow you to specify the correct media size, if you don't know what the media size should be then you can use the Ghostscript -sDEVICE=bbox device to find out.

最后,Ghostscript有一个基本的显示设备,您可以使用它来查看渲染的输出,而无需先进入PNG。

Lastly, Ghostscript has a rudimentary display device which you can use to view the rendered output without first going to a PNG.

这篇关于适合ghostscript中的页面大小(输入可能已损坏)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 00:15