MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: Merging graphic objects, exporting graphics and much more worries...

  • To: mathgroup at smc.vnet.net
  • Subject: [mg70938] RE: [mg70914] Merging graphic objects, exporting graphics and much more worries...
  • From: "David Park" <djmp at earthlink.net>
  • Date: Thu, 2 Nov 2006 06:47:34 -0500 (EST)

First, write little routines to create each type of symbol that you want.
For example, for the one that you used...

symbol[1][y_] := {Hue[0.55], Rectangle[{0, y}, {4, y + 1.5}],
    RGBColor[1, 1, 1], Rectangle[{0.2, y + 0.2}, {3.8, y + 1.3}]}

where y is the parameter for the vertical placement of the symbol on the
card. (Or perhaps you might want to specify both x and y for some symbols.)
Other symbols might be symbol[2] etc.

Then your card image can be produced with...

card1 =
    Show[Graphics[
        {symbol[1][0],
         symbol[1][2.5],
         symbol[1][5]}],
      AspectRatio -> Automatic,
      ImageSize -> 250];

Then obtain a filename (directory location and name) with

filename = Experimental`FileBrowse[]

You would probably type in something like 'playingcard1.bmp'.

Then export with

Export[filename, card1, "BMP"]

That worked for me.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/

From: shp [mailto:spilja at gmail.com]
To: mathgroup at smc.vnet.net

Hi!

I'm pretty new to Mathematica and I'm trying to draw and export some
graphics in it (as a part of a seminar).

What I0m trying to do is make cards (ie bitamps or gifs) for a card
game Set. So what I need to do is draw symbols, 1 to 3 per card, and
export them for later use.

Each card consists of 1 to 3 identical symbols, so what I tried to do
is use a For loop to generate ie 3 symbols like it's shown in this code
(numel is number of elements, y is a variable used for coordinates

numel = 3;
y = 0;
For[i = 1, i = numel,
       Show[Graphics[{Hue[0.55],
            Rectangle[{0, y}, {4, y + 1.5}],
            RGBColor[1, 1, 1], Rectangle[{0.2, y + 0.2}, {3.8, y +
1.3}]}],
        AspectRatio -> Automatic, ImageSize -> 100];
      	i++, y = y + 2.5];

What I need is a way that I can export this in a single bitamp,
containing all three rectangles. Basicaly, I need a way to include the
For loop in Graphics[], but I don't know how :-/

Trying to come up with anything useful, I found out that even the
simplest export results in a disaster.
For instance, exporting these graphics

rectangles = Graphics[{Hue[0.55], Rectangle[{0, 0}, {4, 1.5}],
         Rectangle[{0, 2.5}, {4, 4}],
        Rectangle[{0, 5}, {4, 6.5}],
        RGBColor[1, 1, 1], Rectangle[{0.2, 0.2}, {3.8, 1.3}],
        Rectangle[{0.2, 2.7}, {3.8, 3.8}],
        Rectangle[{0.2, 5.2}, {3.8, 6.3}]}];

with

Export["rectangles.bmp", rectangles, ImageSize->{150,170}];

looks nothing like the image I get using the command

Show[rectangles, AspectRatio->Automatic, ImageSize->(150,170}];

No matter what the coordinates of my rectangles are, I get the same
image, and it's pretty ugly :-/

Help please! Thank you.



  • Prev by Date: Re: Merging graphic objects, exporting graphics and much more worries...
  • Next by Date: Re: Weights option to Regress command not behaving as expected
  • Previous by thread: Re: Merging graphic objects, exporting graphics and much more worries...
  • Next by thread: ExactRootIsolation