Home All Groups Group Topic Archive Search About
Author
24 Mar 2006 5:03 PM
Doru Roman
Hi,

Is there a free software to generate .GIF files?
If not, what is recommended?

Thanks,
Doru

Author
24 Mar 2006 9:24 PM
jeff
Author
24 Mar 2006 10:16 PM
Mythran
hmm..
C# :)

Mythran

Show quoteHide quote
"Doru Roman" <doruro***@rogers.com> wrote in message
news:eWsiQT2TGHA.5552@TK2MSFTNGP14.phx.gbl...
> Hi,
>
> Is there a free software to generate .GIF files?
> If not, what is recommended?
>
> Thanks,
> Doru
>
Author
27 Mar 2006 5:13 PM
Doru Roman
Thanks for the reply Mythran.
So C# is capable of doing that? How?


Show quoteHide quote
"Mythran" <kip_potter@hotmail.comREMOVETRAIL> wrote in message
news:OjsFaC5TGHA.5332@tk2msftngp13.phx.gbl...
> hmm..
> C# :)
>
> Mythran
>
> "Doru Roman" <doruro***@rogers.com> wrote in message
> news:eWsiQT2TGHA.5552@TK2MSFTNGP14.phx.gbl...
>> Hi,
>>
>> Is there a free software to generate .GIF files?
>> If not, what is recommended?
>>
>> Thanks,
>> Doru
>>
>
Author
27 Mar 2006 5:49 PM
Mythran
Show quote Hide quote
"Doru Roman" <doruro***@rogers.com> wrote in message
news:Ow6mNHcUGHA.4300@TK2MSFTNGP14.phx.gbl...
> Thanks for the reply Mythran.
> So C# is capable of doing that? How?
>
>
> "Mythran" <kip_potter@hotmail.comREMOVETRAIL> wrote in message
> news:OjsFaC5TGHA.5332@tk2msftngp13.phx.gbl...
>> hmm..
>> C# :)
>>
>> Mythran
>>
>> "Doru Roman" <doruro***@rogers.com> wrote in message
>> news:eWsiQT2TGHA.5552@TK2MSFTNGP14.phx.gbl...
>>> Hi,
>>>
>>> Is there a free software to generate .GIF files?
>>> If not, what is recommended?
>>>
>>> Thanks,
>>> Doru
>>>
>>
>
>

The System.Drawing namespace, using System.Drawing.Bitmap and
System.Drawing.Graphics objects can be used to create GIF images...below is
an example of creating an image of type GIF that has the time created
display in it.  With some background coloring and borders (simple borders).

Bitmap bmp;
Graphics canvas;
string time = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss");
Font font = new Font("Arial", 52);
SizeF size;

// Create the bitmap and measure the size of the string.
using (bmp = new Bitmap(1, 1)) {
    using (canvas = Graphics.FromImage(bmp)) {
        // Measure the string.
        size = canvas.MeasureString(time, font);
    }
}

// Create a new bitmap that will contain the string.
int width = (int) (size.Width);
int height = (int) (size.Height);
using (bmp = new Bitmap(width, height)) {
    using (canvas = Graphics.FromImage(bmp)) {
        // Prepare the canvas.
        canvas.InterpolationMode =
            InterpolationMode.HighQualityBilinear;

        // Draw the background.
        canvas.Clear(Color.BlanchedAlmond);

        // Draw the border.
        canvas.DrawRectangle(
            Pens.Magenta,
            0,
            0,
            width - 1,
            height - 1
        );

        // Draw the string onto the canvas.
        canvas.DrawString(time, font, Brushes.Blue, 0, 0);
    }

    // Save the image to disk.
    bmp.Save(
        @"C:\images\myImage.gif",
        System.Drawing.Imaging.ImageFormat.Gif
    );
}

Console.WriteLine("Image saved.");

HTH :)

Mythran