Jump to content
You must now use your email address to sign in [click for more info] ×

Encapsulated Postscript


Recommended Posts

Not everything can be easily done with AD tools or can not be done at all. For example, try to draw what is shown at the picture below. There are simply limitations of graphical user interface and some patterns require a different approach. Luckily, Affinity Designer can open encapsulated postscript files. Encapsulated postscript allows you manual generation of high-quality graphics. It means that you write a program in Postscript language which subsequently is interpreted by AD. To do this, you should only have so-called programmers text editor. It can be Apple TextEdit, Wrangler or Textastic. There is a problem, though. Before you try to open EPS file in AD, you should check if your program contains no errors.

 

Postscript and Encapsulated Postscript files are interpreted by GhostScript program which can be called from a command line in Terminal window. First, you have to check if you have Ghostscript installed. If not, then you have to install it. In Terminal enter command:

 

gs -version

 

When the command was not found then you can download the latest version of GhostScript from Richard Koch page (http://pages.uoregon.edu/koch/). Locate the GhostScript link with the highest version number and click on it. This will start the download of the GhostScript package installer. How the download actually happens is dependent on your browser and system setup.

 

Once the installer has downloaded, open the folder it was downloaded to. Double click the PKG icon and follow the on-screen instructions. Accept the defaults if you don't know what to change. Once the install process has finished you can check if GhostScript is installed and ready for action by entering gs command again:

 

bash-3.2$ gs -version

GPL Ghostscript 9.16 (2015-03-30)

Copyright © 2015 Artifex Software, Inc.  All rights reserved.

 

Now you can write simple EPS program and check it with GhostScript. Using text editor enter Truchet Pattern program and save it using eps as filename extension. The code for Truchet Pattern is from "A Short Introduction to PostScript" by Peter Fisher:

 

(http://sus.ziti.uni-heidelberg.de/Lehre/Tools1213/PostScript_PeterFischer.pdf)

 

%!PS-Adobe-3.0 EPSF-3.0

%%BoundingBox: 0 0 592 842

%% File name: TruchetPattern.eps

%%BeginProlog

%%EndProlog

 

2.835 dup scale

5 4 translate 1 setlinecap

0 0 200 290 rectstroke

100 145 translate

 

/W 10 def /W2 { W

 

2 div } bind def

 

/DRAWUNIT {

 

 

  gsave translate rotate

   W2 neg W2 neg W2 0 90 arc stroke

   W2 W2 W2 180 270 arc stroke

   grestore

} def

 

-95 W 95 {

 /x exch def

 -140 W 140 {

     /y exch def

     rand 4 mod 90 mul x y DRAWUNIT

 } for

} for

 

showpage

 

%%EOF

 

In Terminal, go to directory where your EPS file was saved and open it with gs program:

 

bash-3.2$ gs TruchetPattern.eps

GPL Ghostscript 9.16 (2015-03-30)

Copyright © 2015 Artifex Software, Inc.  All rights reserved.

This software comes with NO WARRANTY: see the file PUBLIC for details.

Error: /undefined in setroke

Operand stack:

 

Execution stack:

   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1951   1   3   %oparray_pop   1950   1   3   %oparray_pop   --nostringval--   1934   1   3   %oparray_pop   1820   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   -85   10   95   --nostringval--   %for_pos_int_continue   -130   10   140   --nostringval--   %for_pos_int_continue   --nostringval--

Dictionary stack:

   --dict:1181/1684(ro)(G)--   --dict:0/20(G)--   --dict:87/200(L)--

Current allocation mode is local

Last OS error: Invalid argument

Current file position is 428

GPL Ghostscript 9.16: Unrecoverable error, exit code 1

 

 

Here we have syntax error:

 

Error: /undefined in setroke

 

After correcting this error, subsequent GhostScript run result is:

 

bash-3.2$ gs TruchetPattern.eps

GPL Ghostscript 9.16 (2015-03-30)

Copyright © 2015 Artifex Software, Inc.  All rights reserved.

This software comes with NO WARRANTY: see the file PUBLIC for details.

%%BoundingBox: 12 9 583 835

%%HiResBoundingBox: 12.738234 9.903234 582.611748 834.926740

>>showpage, press <return> to continue<<

 

You should press <return> and enter quit command to exit from GhostScript interpreter:

 

GS>quit

bash-3.2$

 

Such created eps file should be visible in Finder, and Preview program can open it without complaining.

 

When you are sure that EPS program is correct, then you can open it in Affinity Designer, select, copy and paste object into your design.

 

 

 

post-18190-0-87821300-1442494194_thumb.png

TruchetPattern.afdesign

TruchetPattern.eps

Square.eps

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.