[comp.lang.postscript] Changing the size of a drawing

pjh@mccc.edu (Peter J. Holsberg) (05/14/91)

What follows is the beginning of a postscript program to produce a
certain drawing.  I'd like to reduce the size to about 2" by 3",
proportionally, but I know nothing about postscript programming.  Could
someone suggest what I might do?  Thanks.

If you need the whole file, let me know and I'll email it.

Pete
==========

%!PS-Adobe-2.0 EPSF-1.2
%%Creator: Adobe Illustrator 88(TM) 1.9.3
%%For: (Paul Mernyk) (SSD R&D)
%%Title: (teamnet)
%%CreationDate: (1/10/90) (8:08 PM)
%%DocumentProcSets: Adobe_packedarray 0 0
%%DocumentSuppliedProcSets: Adobe_packedarray 0 0
%%DocumentProcSets: Adobe_cmykcolor 0 0
%%DocumentSuppliedProcSets: Adobe_cmykcolor 0 0
%%DocumentProcSets: Adobe_cshow 0 0
%%DocumentSuppliedProcSets: Adobe_cshow 0 0
%%DocumentProcSets: Adobe_customcolor 0 0
%%DocumentSuppliedProcSets: Adobe_customcolor 0 0
%%DocumentProcSets: Adobe_Illustrator881 0 0
%%DocumentSuppliedProcSets: Adobe_Illustrator881 0 0
%%ColorUsage: Color
%%DocumentProcessColors: Black
%%DocumentFonts: Helvetica-BoldOblique
%%DocumentCustomColors: (Red-Orange)
%%CMYKCustomColor: 0 0.75 1 0 (Red-Orange)
%%BoundingBox:5 40 715 530
%%TemplateBox:288 360 288 360
%%TileBox:-730 552 0 1104
%%DocumentPreview: None
%%EndComments
-- 
Prof. Peter J. Holsberg      Mercer County Community College
Voice: 609-586-4800          Engineering Technology, Computers and Math
UUCP:...!princeton!mccc!pjh  1200 Old Trenton Road, Trenton, NJ 08690
Internet: pjh@mccc.edu	     Trenton Computer Festival -- 4/??-??/92

les@chinet.chi.il.us (Leslie Mikesell) (05/15/91)

In article <1991May14.165401.19685@mccc.edu> pjh@mccc.edu (Peter J. Holsberg) writes:
>What follows is the beginning of a postscript program to produce a
>certain drawing.  I'd like to reduce the size to about 2" by 3",
>proportionally, but I know nothing about postscript programming.  Could
>someone suggest what I might do?  Thanks.

>%!PS-Adobe-2.0 EPSF-1.2
>%%BoundingBox:5 40 715 530

If you want to continue knowing nothing about postscript programming
(a good idea IMHO...) then you should just use one of the many programs
that know how to handle EPS files.  If you intend to put the drawing
on a page of text, Wordperfect 5.1 would be a good choice.  If you
want to edit, warp, or otherwise distort the drawing or put text
in circles around it, or lots of other fun stuff, CorelDraw would
be a good choice, though you might still want to just save the modified
output as another EPS file and let Wordperfect print it along with
some normal text.

If you want something free, a set of programs called "psutils" was recently
posted to alt sources.  It included a program called epsfit that will
scale an EPS file to an arbitrary bounding box.  I don't think it knows
about EPS files that include the bitmap for viewing.

Les Mikesell
  les@chinet.chi.il.us

orthlieb@adobe.COM (Carl Orthlieb) (05/17/91)

The best way to scale to the size you want is to look at the bounding box 
values of your graphic:
	%%BoundingBox:5 40 715 530

These represent the lower left and upper right coordinates of your graphic.
This defines a rectange that is 710 x 490 points (where a point is 1/72").
You'll want to scale this down to a rectangle of 216 x 144 points (3" x 2").

Stick the following code at the top of the file:

	/MyScale { 216 710 div 144 490 div scale } bind def

This will scale non-uniformly but ensures that the graphic is exactly 
2" x 3".

If you want to scale uniformly in the X direction:

	/MyScale { 216 710 div dup scale } bind def

If you want to scale uniformly in the Y direction:

	/MyScale { 144 490 div dup scale } bind def

You'll probably also want to translate the picture around on the page:

	X Y translate			% Position on the page
	MyScale				% Scale to desired size
	-5 -40 translate		% Translate pic to lower left corner

Where X and Y are expressed in 1/72 of an inch.  If you want the resulting
picture to be 1 inch from the left hand edge of the page and 2 inches
from the bottom, then X = 72 and Y = 144.

Hope this helps, 

Carl 8^)