在postscript中添加图像的简单方法 [英] Simple way to add an image in postscript

查看:129
本文介绍了在postscript中添加图像的简单方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在postscript中编写一个文档。

I am trying to write a document in postscript.

到目前为止,我已经能够编写简单的文本,并使用线条和形状。

Thus far I've been able to write simple text, and work with lines and shapes.

我现在正试图在文档中添加一些图像。在网上搜索之后我似乎无法找到任何明确的方法。

I'm now trying to add some images to the document. After searching on-line I can't seem to find any clear way to do this.

下面的剪辑是一个问候世界:

the snip it below is a hello world:

%!PS
/Times               
20 selectfont         
20 800 moveto         
(Hello World!) show
showpage 

我想做的只是插入图片(例如PNG,JPG,GIF) )通过指定x和y,坐标。

All I want to do is simply insert an image (eg PNG, JPG, GIF) by specifying the x and y, co-ordinates.

任何帮助都会非常感激。

Any help would be much appreciated.

推荐答案

有一个简单的方法,Postscript支持jpeg格式。如果您使用的是ghostscript,则可能必须使用-dNOSAFER选项来打开文件。这是一个例子:

There is a simple method and Postscript does support the jpeg format. If you are using ghostscript you may have to use the -dNOSAFER option to open files. Here is an example:

gsave
 360 72 translate     % set lower left of image at (360, 72)
  175 47 scale         % size of rendered image is 175 points by 47 points
  500                   % number of columns per row
  133                    % number of rows
  8                    % bits per color channel (1, 2, 4, or 8)
  [500 0 0 -133 0 133]       % transform array... maps unit square to pixel
  (myJPEG500x133.jpg) (r) file /DCTDecode filter % opens the file and filters the image data
  false                 % pull channels from separate sources
  3                    % 3 color channels (RGB)
  colorimage
grestore

这篇关于在postscript中添加图像的简单方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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