2

How do you resize .eps file using ghostscript or some other command line utility available for macOS or ruby? I would like to specify the resolution such as 1000x1000 and not the scale.

Similar to this post but resizing with a specified resolution How to resize an EPS file with free software or command line utility

Community
  • 1
  • 1
waroo
  • 310
  • 2
  • 14
  • Its not clear to me what you mean by 'resize' an EPS. One of the major points of EPS is that it can be included in a parent document, which can rescale it to fit in a specified area. EPS files are normally resolution-independent so there is no point in 'specifying the resolution', since EPS is a vector format you **must** specify the scale. YOu calculate the scale by looking at the declared BoundingBox and comparing that with the area you want to cover, then using the PostScript scale operator. – KenS Sep 23 '16 at 07:13
  • Ok. So the correct terminology for my question would probably be closer to. I want to increase the bounding box of my document to 1000x1000 and then scale the image larger to fit 100% inside the document. – waroo Sep 23 '16 at 13:02
  • Read the BoundingBox comments from the EPS file. Divide 1000 by the width and height to get 2 numbers. If you want it scaled the same in each direction, take the smaller value, otherwise use both. In the enclosing PostScript program put 'x y scale' where x and y are the numbers you calculated. Job done. You don't increase the bounding box of the EPS. The bounding box comments are there to tell you where the extent of the marks are. If you want the output larger or smaller than that, then you simply apply a scale. – KenS Sep 23 '16 at 14:23

1 Answers1

2

Thanks @KenS for the help. For reference this is the command I ended up using.

gs -o input.eps -dEPSFitPage -sDEVICE=eps2write -c "<</Install {10 10 scale}>> setpagedevice" -f output.eps
waroo
  • 310
  • 2
  • 14