drawing shapes in gimp?

Chris F.A. Johnson cfaj-uVmiyxGBW52XDw4h08c5KA at public.gmane.org
Wed Jun 24 05:16:44 UTC 2009


On Wed, 24 Jun 2009, Matt Price wrote:

> 
> On Tue, 2009-06-23 at 15:31 -0400, Chris F.A. Johnson wrote:
> > On Tue, 23 Jun 2009, Matt Price wrote:
> > 
> > > hey there,
> > > 
> > > I need to draw a simple picture, a five-pointed star on a monocolor
> > > background.  What would be the best way for me to this in gimp or some
> > > other program?
> > 
> > $ cat star.ps
> > %!PS-Adobe-2.0 EPSF-2.0
> > %%BoundingBox: 0 0 70 70
> > .7 .2 .2 setrgbcolor
> > 20 0 moveto
> > 5 { 50 50 rlineto 144 rotate } repeat fill
> > $ convert -trim star.ps star.png
> 
> ah.  very nice.  so now you're telling me that to draw, i need to learn
> postscript?  that was NOT what i wanted to hear...  still very cool.
> having trouble understnading what's going on, though.  suppose i want
> the picture 5 times as big?

%!PS-Adobe-2.0 EPSF-2.0
%%BoundingBox: 0 0 350 350
5 5 scale
-9 rotate
.7 .2 .2 setrgbcolor
13 2  moveto
5 { 50 50 rlineto 144 rotate } repeat fill


>  i guess i can scale it in gimp -- though
> now i try it out, that doesn't seem trivial to do.

   Image -> Scale Image -> Width 350 (But you'll get a much better
   result scaling it in postscript.

> and if i want to
> generate the initial picture with one point going straight up?

   See above.

>  these
> pics are just slightly off to the side, i guess about 10 degrees.
> again, i can rotate in gimp...  but it'd be nice if the script just did
> it perfectly, wouldn't it.  any chance you could explain what you're
> doing here a bit more fully?

%!PS-Adobe-2.0 EPSF-2.0     %% Magic number etc.
%%BoundingBox: 0 0 350 350  %% Outer limits of the image
5 5 scale                   %% scale x and y by a factor of 5
-9 rotate                   %% rotate the canvas by -9 degrees
.7 .2 .2 setrgbcolor        %% set the RGB values
13 2  moveto                %% move 13 pts along x axis, 2 up the y axis
5 {                         %% set N
 50 50 rlineto              %% draw a line from the current point
                            %% to a point 50 pixels along both axes
 144 rotate                 %% rotate the aspect 144 degrees
 } repeat                   %% do it N times
 fill                       %% fill the figure with the current colour


-- 
   Chris F.A. Johnson, webmaster         <http://woodbine-gerrard.com>
   ===================================================================
   Author:
   Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list