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

• To: mathgroup at smc.vnet.net
• Subject: [mg70933] Re: Merging graphic objects, exporting graphics and much more worries...
• From: dh <dh at metrohm.ch>
• Date: Thu, 2 Nov 2006 06:47:10 -0500 (EST)
• References: <ei9pdo\$28k\$1@smc.vnet.net>

```
Hi,

you are nearle there, only some small mkodificatioin needed:

First make an empt array: g={};

then append your graphics to this array:

numel=3;

y=0;

For[i=1,i<=numel,i++,

AppendTo[g,

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\[Rule]Automatic,

ImageSize\[Rule]100]];y=y+2.5];

then combine the tthree plots into one:

g=Show[GraphicsArray[List/@ g]];

and export this:

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

Daniel

shp wrote:

> 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 :-/

>