Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.postscript > #2639 > unrolled thread
| Started by | Peter Billam <peter@www.pjb.com.au> |
|---|---|
| First post | 2016-06-10 11:17 +0000 |
| Last post | 2016-06-12 02:37 -0700 |
| Articles | 7 — 5 participants |
Back to article view | Back to comp.lang.postscript
PageSize v. BoundingBox Peter Billam <peter@www.pjb.com.au> - 2016-06-10 11:17 +0000
Re: PageSize v. BoundingBox Carlos <angus@quovadis.com.ar> - 2016-06-10 15:00 +0200
Re: PageSize v. BoundingBox ken <ken@spamcop.net> - 2016-06-10 17:22 +0100
Re: PageSize v. BoundingBox Peter Billam <peter@www.pjb.com.au> - 2016-06-11 01:55 +0000
Re: PageSize v. BoundingBox Lawrence D’Oliveiro <lawrencedo99@gmail.com> - 2016-06-10 19:18 -0700
Re: PageSize v. BoundingBox Peter Billam <peter@www.pjb.com.au> - 2016-06-11 02:43 +0000
Re: PageSize v. BoundingBox jdaw1 <jdawiseman@gmail.com> - 2016-06-12 02:37 -0700
| From | Peter Billam <peter@www.pjb.com.au> |
|---|---|
| Date | 2016-06-10 11:17 +0000 |
| Subject | PageSize v. BoundingBox |
| Message-ID | <slrnnll8f1.5c2.peter@box8.pjb.com.au> |
Hi. currentpagedevice (PageSize) get == prints out: [594.672 841.829956] i.e. A4 in point. Now if I add a: %%BoundingBox: 0 0 75 37.5 line, I would expect it to print [75 37.5] ; but it doesn't, gs prints [594.672 841.829956] as before, which doesn't seem useful :-( Is there a way from within the code of finding the BoundingBox size? Peter -- Peter Billam www.pjb.com.au www.pjb.com.au/comp/contact.html
[toc] | [next] | [standalone]
| From | Carlos <angus@quovadis.com.ar> |
|---|---|
| Date | 2016-06-10 15:00 +0200 |
| Message-ID | <njedlk$c6g$1@dont-email.me> |
| In reply to | #2639 |
On 10/06/2016 13:17, Peter Billam wrote: > Hi. > currentpagedevice (PageSize) get == > prints out: > [594.672 841.829956] > i.e. A4 in point. Now if I add a: > %%BoundingBox: 0 0 75 37.5 > line, I would expect it to print [75 37.5] ; but it doesn't, gs > prints [594.672 841.829956] as before, which doesn't seem useful :-( > Is there a way from within the code of finding the BoundingBox size? DSC comments are there to make declarations *about* the code, they don't affect the interpreter's state. In this case, you are asserting that your PostScript program doesn't draw outside that bounding box (so it better be true). Also, the bounding box is not related to the page size. It can extend outside the page, or cover only part of it, etc. You can use rectclip to make sure you don't draw outside a bounding box. --
[toc] | [prev] | [next] | [standalone]
| From | ken <ken@spamcop.net> |
|---|---|
| Date | 2016-06-10 17:22 +0100 |
| Message-ID | <MPG.31c4f97f90a819e989906@usenet.plus.net> |
| In reply to | #2639 |
In article <slrnnll8f1.5c2.peter@box8.pjb.com.au>, peter@www.pjb.com.au says... > > Hi. > currentpagedevice (PageSize) get == > prints out: > [594.672 841.829956] > i.e. A4 in point. Now if I add a: > %%BoundingBox: 0 0 75 37.5 > line, I would expect it to print [75 37.5] ; but it doesn't, gs > prints [594.672 841.829956] as before, which doesn't seem useful :-( As Carlos already pointed out, comments are just comments (any line beginning '%' is a comment), PostScript interpreters ignore comments. DSC comments are present for DSC parsers to handle, In particular they are used when an application imports an EPS into its content. If you want to alter the media size the you need the setpagedevice operator. Eg: <</PageSize [75 37.5]>> setpagedevice will request media which is 75x37.5 points (ie very small, approx 1 inch by half an inch). You can also use -dDEVICEWIDTHPOINTS and - dDEVICEHEIGHTPOINTS, the -g switch, and possibly some other ways that I've forgottten about. In short, there are lots of ways to set the media size, but comments aren't one of them. > Is there a way from within the code of finding the BoundingBox size? If your file is an EPS file then -dEPSCrop will crop the media to the declared BoundingBox. There is also a rudimentary DSC parser available in Ghostscript, you can find more about it in the documentation. If you want to know the actual bounding box of a random piece of PostScript you can use Ghostscript's bbox device which will tell you. Ken
[toc] | [prev] | [next] | [standalone]
| From | Peter Billam <peter@www.pjb.com.au> |
|---|---|
| Date | 2016-06-11 01:55 +0000 |
| Message-ID | <slrnnlmrsq.1gg.peter@box8.pjb.com.au> |
| In reply to | #2641 |
On 2016-06-10, ken <ken@spamcop.net> wrote: > In article <slrnnll8f1.5c2.peter@box8.pjb.com.au>, peter@www.pjb.com.au > says... >> i.e. A4 in point. Now if I add a: >> %%BoundingBox: 0 0 75 37.5 >> line, I would expect it to print [75 37.5] ; but it doesn't, gs >> prints [594.672 841.829956] as before, which doesn't seem useful :-( > > If you want to alter the media size the you need the setpagedevice > operator. Eg: <</PageSize [75 37.5]>> setpagedevice I think the problem was that I was using _EPS_ to produce my little jpegs of particular sizes: for example, all the jpegs in http://www.pjb.com.au/mus/beethoven/sketches_1.html#p5 http://www.pjb.com.au/mus/beethoven/sketches_2.html#p44 http://www.pjb.com.au/mus/wagner/index.html (just click a Scene tag) were generated in this way. Then gs -sDEVICE=jpeg is perfectly aware of what its BoundingBox is, and produces a jpeg of the right size :-) But it did mean (this wasn't an issue in the above examples) that if I needed to position something according to that size, I had to retype number literals from one place in the code to another, which is bad programming practice (for several good reasons). But: I should probably do my little jpegs without using EPS at all, but just within PS by changing the /PageSize as above. (I've been using EPS so that my little graphics could then be inserted into html in jpg form, or into desktop-publishing or other PS in EPS form; very orthogonal :-)) > will request media which is 75x37.5 points (ie very small, approx > 1 inch by half an inch). You can also use -dDEVICEWIDTHPOINTS and > -dDEVICEHEIGHTPOINTS, the -g switch, and possibly some other ways > that I've forgottten about. In short, there are lots of ways > to set the media size, but comments aren't one of them. gs respects the BoundingBox comment when setting the jpeg media-size. Thanks, regards, Peter -- Peter Billam www.pjb.com.au www.pjb.com.au/comp/contact.html
[toc] | [prev] | [next] | [standalone]
| From | Lawrence D’Oliveiro <lawrencedo99@gmail.com> |
|---|---|
| Date | 2016-06-10 19:18 -0700 |
| Message-ID | <1b1fbbfa-6e46-44cb-bf76-069185a7e3e9@googlegroups.com> |
| In reply to | #2642 |
On Saturday, June 11, 2016 at 1:56:56 PM UTC+12, Peter Billam wrote: > (I've been using EPS so that my little graphics could then be > inserted into html in jpg form, or into desktop-publishing or > other PS in EPS form; very orthogonal :-)) 1) I wouldn’t use JPEG for hard-edged graphics like that. Have you tried PNG? Then you could also leave the background transparent. 2) Does anybody still care about EPS for desktop publishing? I imagine rasterizing at something like 360dpi (OK, maybe 720dpi for bilevel) would be sufficient for any paper-publishing need...
[toc] | [prev] | [next] | [standalone]
| From | Peter Billam <peter@www.pjb.com.au> |
|---|---|
| Date | 2016-06-11 02:43 +0000 |
| Message-ID | <slrnnlmune.1s1.peter@box8.pjb.com.au> |
| In reply to | #2643 |
> On Saturday, June 11, 2016 at 1:56:56 PM UTC+12, Peter Billam wrote: >> gs respects the BoundingBox comment when setting the jpeg media-size. That's not true :-( sorry! it's convert that respects BoundingBox convert t.eps t.jpg I've been using gs through a preprocessor script which extracted the BoundingBox numbers and then invoked gs -q -sDEVICE=jpeg -g75x37.5 -sOutputFile=t.jpg accordingly. (It's all invoked from Makefiles of course.) But I should have been using PageSize within t.ps anyway. >> (I've been using EPS so that my little graphics could then be >> inserted into html in jpg form, or into desktop-publishing or >> other PS in EPS form; very orthogonal :-)) On 2016-06-11, Lawrence D’Oliveiro <lawrencedo99@gmail.com> wrote: > 1) I wouldn’t use JPEG for hard-edged graphics like that. Have you > tried PNG? Then you could also leave the background transparent. Fair enough; I might restandardise on png. > 2) Does anybody still care about EPS for desktop publishing? I don't really know, I've never used it :-) > I imagine rasterizing at something like 360dpi (OK, maybe 720dpi > for bilevel) would be sufficient for any paper-publishing need... Bigger files, though... Thanks, Peter -- Peter Billam www.pjb.com.au www.pjb.com.au/comp/contact.html
[toc] | [prev] | [next] | [standalone]
| From | jdaw1 <jdawiseman@gmail.com> |
|---|---|
| Date | 2016-06-12 02:37 -0700 |
| Message-ID | <4f82ca7c-5a00-4271-b64e-29bab63c9500@googlegroups.com> |
| In reply to | #2644 |
> >> (I've been using EPS so that my little graphics could then be > >> inserted into html in jpg form, or into desktop-publishing or > >> other PS in EPS form; very orthogonal :-)) > > On 2016-06-11, Lawrence D’Oliveiro … wrote: > > 1) I wouldn’t use JPEG for hard-edged graphics like that. Have you > > tried PNG? Then you could also leave the background transparent. > > Fair enough; I might restandardise on png. If using PNG, you might also want to use https://imageoptim.com/mac which seems very good at reducing file sizes.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.postscript
csiph-web