Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.postscript > #2725
| Path | csiph.com!weretis.net!feeder6.news.weretis.net!nntp.club.cc.cmu.edu!micro-heart-of-gold.mit.edu!bloom-beacon.mit.edu!bloom-beacon.mit.edu!panix!panix.com!forkosh |
|---|---|
| From | JohnF <john@please.see.sig.for.email.com> |
| Newsgroups | comp.lang.postscript |
| Subject | Re: Putting lines from a file into an array |
| Date | Wed, 3 Aug 2016 06:21:42 +0000 (UTC) |
| Organization | PANIX Public Access Internet and UNIX, NYC |
| Lines | 67 |
| Message-ID | <nns2hm$4qp$1@reader2.panix.com> (permalink) |
| References | <87624kp6hc.fsf@Compaq.site.inet> <bb7c7717-e527-41ca-b264-ef2f9d3cb23e@googlegroups.com> <nnp4lg$5e1$1@reader2.panix.com> <61d3b2d1-0318-4be3-959b-b955192dab31@googlegroups.com> <c7f6de83-cb5c-4510-92f4-2844130c4a1c@googlegroups.com> <8b56c6b3-1d1d-47d2-aa00-32deffb3fc7c@googlegroups.com> |
| NNTP-Posting-Host | panix3.panix.com |
| X-Trace | reader2.panix.com 1470205302 4953 166.84.1.3 (3 Aug 2016 06:21:42 GMT) |
| X-Complaints-To | abuse@panix.com |
| NNTP-Posting-Date | Wed, 3 Aug 2016 06:21:42 +0000 (UTC) |
| User-Agent | tin/1.6.2-20030910 ("Pabbay") (UNIX) (NetBSD/6.1.5 (i386)) |
| Xref | csiph.com comp.lang.postscript:2725 |
Show key headers only | View raw
luser droog <luser.droog@gmail.com> wrote:
> On Wednesday, August 3, 2016 at 12:20:34 AM UTC-5, luser droog wrote:
>> On Tuesday, August 2, 2016 at 11:58:10 PM UTC-5, luser droog wrote:
>> > > > Earlier revisions are less "golfed" and easier to read:
>> > > > http://codegolf.stackexchange.com/revisions/71388/1
>> >
>> > #!/bin/bash
>> > filename=$1
>> > toptext=$2
>> > bottext=$3
>> >
>> > dims=`identify $filename | cut -d' ' -f3`
>> > dimx=`echo $dims | cut -d'x' -f1`
>> > dimy=`echo $dims | cut -d'x' -f2`
>> > convert $filename $filename.eps
>> > gs -q -g"$dims" -o $filename.png -sDEVICE=png48 -c "
>> > /oldshowpage /showpage load def /showpage {} def
>> > ($filename.eps)run matrix defaultmatrix setmatrix
>> > /Helvetica-Bold 22 selectfont
>> > /ceshow {
>> > dup stringwidth pop neg 2 div 0 rmoveto
>> > dup gsave 1 setgray show grestore
>> > 0 setgray false charpath stroke
>> > } def
>> > $dimx 2 div $dimy 42 sub moveto ($toptext) ceshow
>> > $dimx 2 div 8 moveto ($bottext) ceshow
>> > oldshowpage "
>> >
>> > echo Your meme is ready in $filename.png
>> >
>> > Stupid MS Edge won't let me save the image. So while firing
>> > up X, let me quote the readable version and offer my first
>> > guess that the black and white image produces a different
>> > number of words from `identify` and so the dims are not
>> > found in field 3.
>>
>> Weird. That isn't the problem at all. The eps is getting a
>> smaller sized version.
>>
>> josh@LAPTOP-ILO10OOF ~/meme
>> $ identify duckrabbit.jpg
>> duckrabbit.jpg JPEG 519x350 519x350+0+0 8-bit sRGB 39.3KB 0.031u 0:00.027
>>
>> josh@LAPTOP-ILO10OOF ~/meme
>> $ grep BoundingBox duckrabbit.jpg.eps
>> %%BoundingBox: -0 -0 187 126
>> %%HiResBoundingBox: 0 0 186.84 126
>> %%PageBoundingBox: 0 0 187 126
>>
>> If the script were to get the dims with something like
>>
>> convert $1 $1.eps
>> dims=`grep %%BoundingBox $1.eps`
>> x=`echo $dims| cut -d' ' -f4`
>> y=`echo $dims| cut -d' ' -f5`
>>
>> that should get the right numbers to gs.
>
> oops. that gets x and y but dims isn't the right format for the -g arg.
Thanks for trying. I'll check back to see if you solve the problem,
but, like I said, please don't try too hard. I imagine imagemagick
or gimp or similar tool could do the job if I really needed it done.
(One or the other of Mr.Duck or Mr.Rabbit is, however, quite depressed
by the failure, though I can't quite tell which one.)
--
John Forkosh ( mailto: j@f.com where j=john and f=forkosh )
Back to comp.lang.postscript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Putting lines from a file into an array Cecil Westerhof <Cecil@decebal.nl> - 2012-12-02 21:02 +0100
Re: Putting lines from a file into an array Chris <cjl@spamcop.net> - 2012-12-02 20:47 +0000
Re: Putting lines from a file into an array Cecil Westerhof <Cecil@decebal.nl> - 2012-12-03 00:52 +0100
Re: Putting lines from a file into an array Don Lancaster <don@tinaja.com> - 2012-12-05 11:58 -0700
Re: Putting lines from a file into an array "luser.droog" <luser.droog@gmail.com> - 2012-12-05 23:19 -0600
Re: Putting lines from a file into an array John Deubert <john@acumentraining.com> - 2012-12-03 13:20 -0800
Re: Putting lines from a file into an array "luser.droog" <luser.droog@gmail.com> - 2012-12-04 00:58 -0600
Re: Putting lines from a file into an array Chris <cjl@spamcop.net> - 2012-12-04 09:09 +0000
Re: Putting lines from a file into an array John Deubert <john@acumentraining.com> - 2012-12-04 07:03 -0800
Re: Putting lines from a file into an array Chris <cjl@spamcop.net> - 2012-12-04 17:46 +0000
Re: Putting lines from a file into an array Cecil Westerhof <Cecil@decebal.nl> - 2012-12-04 17:17 +0100
Re: Putting lines from a file into an array "luser.droog" <luser.droog@gmail.com> - 2012-12-02 15:31 -0600
Re: Putting lines from a file into an array Cecil Westerhof <Cecil@decebal.nl> - 2012-12-03 02:19 +0100
Re: Putting lines from a file into an array "luser.droog" <luser.droog@gmail.com> - 2012-12-02 23:28 -0600
Re: Putting lines from a file into an array Cecil Westerhof <Cecil@decebal.nl> - 2012-12-03 10:01 +0100
Re: Putting lines from a file into an array luser droog <luser.droog@gmail.com> - 2016-08-01 13:25 -0700
Re: Putting lines from a file into an array JohnF <john@please.see.sig.for.email.com> - 2016-08-02 03:39 +0000
Re: Putting lines from a file into an array luser droog <luser.droog@gmail.com> - 2016-08-02 21:58 -0700
Re: Putting lines from a file into an array Tonton Th <tTh@nowhere.invalid> - 2016-08-03 05:10 +0000
Re: Putting lines from a file into an array luser droog <luser.droog@gmail.com> - 2016-08-02 22:20 -0700
Re: Putting lines from a file into an array luser droog <luser.droog@gmail.com> - 2016-08-02 22:35 -0700
Re: Putting lines from a file into an array JohnF <john@please.see.sig.for.email.com> - 2016-08-03 06:21 +0000
Re: Putting lines from a file into an array JohnF <john@please.see.sig.for.email.com> - 2016-08-03 06:32 +0000
Re: Putting lines from a file into an array luser droog <luser.droog@gmail.com> - 2016-08-22 22:31 -0700
csiph-web