updated print.m
Ben Abbott
bpabbott at mac.com
Mon Apr 20 20:07:28 CDT 2009
On Apr 20, 2009, at 8:19 PM, Michael D. Godfrey wrote:
> Ben wrote:
>> Michael (others), as you have some experience with gs, can you tell
>> me if it is possible for gs to use the bounding box to crop the
>> image. Thus producing a bitmap whose size is that of the bounding
>> box?
>
> Here are some pointers:
>
> 1. From the online doc:
> EPS parameters
>
> -dEPSCrop
> Crop an EPS file to the bounding box. This is useful when
> converting an EPS file to a bitmap.
>
> -dEPSFitPage
> Resize an EPS file to fit the page. This is useful for enlarging
> an EPS file to fit the paper size when printing.
>
> -dNOEPS
> Prevent special processing of EPS files. This is useful when EPS
> files have incorrect Document Structuring Convention comments.
>
> ===================================================
> This came from the EPS section of:
> http://ghostscript.com/doc/8.54/Use.htm
>
> This is a good place to start to "learn all about it."
> There is lots of documentation, and lots of switches/options. maybe
> more than are
> really needed, but GhostScript has been around for a very long time...
>
> Enjoy!
>
> Michael
Thanks Michael.
I noticed that converting an eps-file to a bitmap does not give the
same result as printing a bitmap.
Consider the example ...
figure (1)
clf
plot (1:10)
set (gca, "fontsize", 12)
xlabel ("my xlabel")
ylabel ("my ylabel")
title ("my title")
print (gcf, "-djpeg", "test.jpeg")
print (gcf, "-deps", "test.eps")
system ("gs -r150 -sDEVICE=jpeg -sOutputFile=test_gs.jpeg -dEPSCrop -
dBATCH test.eps")
The quality of the converted jpeg is degraded and the fontsize is
different. If the fontsize is increased by 50%, then the proper size
is obtained (I may be off by a point or two).
set (0, "showhiddenhandles", "on")
set (findobj (gca, "-property", "fontsize"), "fontsize", 18)
print (gcf, "-deps", "test.eps")
system ("gs -r150 -sDEVICE=jpeg -sOutputFile=test_gs.jpeg -dEPSCrop -
dBATCH test.eps")
I expect the same behavior occurs when using ImageMagick, but thought
I should mention it now so it doesn't surprise anyone.
Regarding using gs, the ability to crop to the bounding box would be
useful if applied to all ps output. Presently, the bounding box is
50pts inside the pagesize. Which (depending upon the ps interpreterer)
can result in cropping the image.
If gs is used, we can render a page 100pts wider and taller than
desired and then crop it to the proper size. This would mean that gs
would be a necessary run time dependency (is it already?).
Thoughts, comments, suggestions?
I'll try to put together a quick changeset tomorrow (or maybe the next).
Ben
More information about the Octave-maintainers
mailing list