---
title: "SWF File Format"
canonical: https://www.graphicsmill.com/docs/gm5/SWFFileFormat.htm
product: "Graphics Mill 5.5 for .NET"
---

This documentation is for the old version. [Go to the latest Graphics Mill docs](https://www.graphicsmill.com/docs/gm/)

# SWF File Format
 
SWF format was developed by Macromedia Inc. It stands for "Shockwave File Format". The SWF file formats are ideal for vector graphics that may have audio and may even be interactive. To open the SWF file the web browser may use the flash plug-in. However Graphics Mill for .NET allows only import raster blocks to SWF. It is convenient if you need to pass images to applications based on the Macromedia Flash.
 
Graphics Mill for .NET allows saving several frames into one SWF file. It enables you to create animated Flash movies (which will have quite large size though).
 
## Format Name
  
SWF
 
## MIME Type
  
application/x-shockwave-flash
 
## File Extensions
  
\*.swf
 
## Supported Pixel Formats
  
|  Description |  Read |  Write |
| --- | --- | --- |
 |  1 bit palette-based |  No |  Yes |
 |  4 bit palette-based |  No |  Yes |
 |  8 bit palette-based |  No |  Yes |
 |  24 bit RGB |  No |  Yes |
 |  32 bit RGB |  No |  Yes |
 |  32 bit RGB with the alpha channel |  No |  Yes |
 
## Encoder Options
  
|  Name |  Default Value |  Comments |
| --- | --- | --- |
 |  [SwfEncoderOptions.BackgroundColor](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_SwfEncoderOptions_BackgroundColor.htm.md) <br> [SwfWriter.BackgroundColor](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_SwfWriter_BackgroundColor.htm.md) |  **white** |  Background color for the SWF movie. |
 |  [SwfEncoderOptions.Compression](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_SwfEncoderOptions_Compression.htm.md) <br> [SwfFrame.Compression](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_SwfFrame_Compression.htm.md) |  [CompressionType.Zip](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_CompressionType.htm.md) |  CompressionType value that specifies necessary SWF compression type. |
 |  [SwfEncoderOptions.Delay](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_SwfEncoderOptions_Delay.htm.md) <br> [SwfFrame.Delay](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_SwfFrame_Delay.htm.md) |  **0** |  Number of hundredths (1/100) of a second to wait after rendering the frame. |
 |  [SwfEncoderOptions.DisposalMethod](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_SwfEncoderOptions_DisposalMethod.htm.md) <br> [SwfFrame.DisposalMethod](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_SwfFrame_DisposalMethod.htm.md) |  [DisposalMethod.None](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_DisposalMethod.htm.md) |  Codecs.DisposalMethod value that specifies a disposal method for the frame. |
 |  [SwfEncoderOptions.Height](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_SwfEncoderOptions_Height.htm.md) <br> [SwfWriter.Height](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_SwfWriter_Height.htm.md) |  **0** |  SWF movie height (in pixels). If **0**, the height of the first frame will be used. |
 |  [SwfEncoderOptions.Quality](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_SwfEncoderOptions_Quality.htm.md) <br> [SwfFrame.Quality](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_SwfFrame_Quality.htm.md) |  **75** |  Value in range [0, 100] specifying JPEG quality |
 |  [SwfEncoderOptions.Width](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_SwfEncoderOptions_Width.htm.md) <br> [SwfWriter.Width](https://www.graphicsmill.com/docs/gm5/P_Aurigma_GraphicsMill_Codecs_SwfWriter_Width.htm.md) |  **0** |  SWF movie width (in pixels). If **0**, the width of the first frame will be used. |
 
## Examples
  
### Saving an Image into SWF File Format
 
The code example below converts JPEG file into the SWF image frame.
 
```
Dim bitmap As New Aurigma.GraphicsMill.Bitmap("c:\Mountain.jpg")

bitmap.Save("C:\Mountain.swf", _
    New Aurigma.GraphicsMill.Codecs.SwfEncoderOptions(30))

bitmap.Dispose()
```
 
```csharp
using (Aurigma.GraphicsMill.Bitmap bitmap = 
            new Aurigma.GraphicsMill.Bitmap(@"C:\Mountain.jpg"))
{
    bitmap.Save(@"C:\Mountain.swf", 
        new Aurigma.GraphicsMill.Codecs.SwfEncoderOptions(30));
}
```
 
### Creating Animated SWF Movie
 
To create an animated SWF movie we need to use the [SwfWriter](https://www.graphicsmill.com/docs/gm5/T_Aurigma_GraphicsMill_Codecs_SwfWriter.htm.md) class. The movie is created from the several JPEG files.
 
```
Dim dir As String = "C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\"
Dim images As String() = {"Blue hills.jpg", "Sunset.jpg", "Water lilies.jpg", "Winter.jpg"}

Dim bitmap As New Aurigma.GraphicsMill.Bitmap

Dim writer As New Aurigma.GraphicsMill.Codecs.SwfWriter("C:\Mountain.swf")

For Each image As String In images
    bitmap.Load(dir & image)

    Dim frame As New Aurigma.GraphicsMill.Codecs.SwfFrame
    frame.Compression = Aurigma.GraphicsMill.Codecs.CompressionType.Jpeg
    frame.Quality = 30
    frame.Delay = 100
    frame.SetBitmap(bitmap)

    writer.AddFrame(frame)

    frame.Dispose()
Next

bitmap.Dispose()

writer.Dispose()
```
 
```csharp
string dir = @"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\";
string[] images = {"Blue hills.jpg", "Sunset.jpg", "Water lilies.jpg", "Winter.jpg"};

using (Aurigma.GraphicsMill.Bitmap bitmap = 
           new Aurigma.GraphicsMill.Bitmap())
{
    using (Aurigma.GraphicsMill.Codecs.SwfWriter writer = 
               new Aurigma.GraphicsMill.Codecs.SwfWriter(@"C:\Mountain.swf"))
    {
        foreach (string image in images)
        {
            bitmap.Load(dir + image);

            using (Aurigma.GraphicsMill.Codecs.SwfFrame frame = 
                       new Aurigma.GraphicsMill.Codecs.SwfFrame())
            {
                frame.Compression = Aurigma.GraphicsMill.Codecs.CompressionType.Jpeg;
                frame.Quality = 30;
                frame.Delay = 100;
                frame.SetBitmap(bitmap);

                writer.AddFrame(frame);
            }
        }
    }
}
```
