---
title: "CompressedImage.CreateFromFile Method (String, CompressionType)"
canonical: https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_CompressedImage_CreateFromFile_2_b37a28d3.htm
archived: false
applies_to:
  - product: "Graphics Mill"
    versions: ["12.1", "6.x-12.x (may differ)"]
    entity_id: "https://www.graphicsmill.com/#software-application"
---

# CompressedImage.CreateFromFile Method (String, CompressionType)

**Applies to:** Graphics Mill 12.1, 6.x-12.x (may differ)
 
Creates a [CompressedImage](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_CompressedImage.htm.md) directly from a file.
 
**Namespace:** [Aurigma.GraphicsMill](https://www.graphicsmill.com/docs/gm/N_Aurigma_GraphicsMill.htm.md)
 **Assembly:** Aurigma.GraphicsMill (in Aurigma.GraphicsMill.dll)
 
## Syntax
  
```csharp
public static CompressedImage CreateFromFile(string fileName,CompressionType compression
)
```
 
### Parameters
 
 - fileName
     - Type: System.String
The path to the source image file.

 - compression
     - Type: [Aurigma.GraphicsMill.Codecs.CompressionType](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_CompressionType.htm.md)
 
### Return Value
A new [CompressedImage](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_CompressedImage.htm.md) instance.
   
## See Also

### Reference

- [CompressedImage Class](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_CompressedImage.htm.md)
- [CreateFromFile Overload](https://www.graphicsmill.com/docs/gm/O_T_Aurigma_GraphicsMill_CompressedImage_CreateFromFile.htm.md)
- [Aurigma.GraphicsMill Namespace](https://www.graphicsmill.com/docs/gm/N_Aurigma_GraphicsMill.htm.md)

### Manual

- [Compressed Image](https://www.graphicsmill.com/docs/gm/compressed-image.htm.md)
