---
title: "CompressedImage.CreateFromStream Method (Stream, CompressionType)"
canonical: https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_CompressedImage_CreateFromStream_2_5cfc5e32.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.CreateFromStream Method (Stream, 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 stream.
 
**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 CreateFromStream(Stream stream,CompressionType compression
)
```
 
### Parameters
 
 - stream
     - Type: System.IO.Stream
A Stream containing the image to compress.

 - compression
     - Type: [Aurigma.GraphicsMill.Codecs.CompressionType](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_CompressionType.htm.md)
A [CompressionType](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_CompressionType.htm.md) specifying how to compress the image data.
 
### 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)
- [CreateFromStream Overload](https://www.graphicsmill.com/docs/gm/O_T_Aurigma_GraphicsMill_CompressedImage_CreateFromStream.htm.md)
- [Aurigma.GraphicsMill Namespace](https://www.graphicsmill.com/docs/gm/N_Aurigma_GraphicsMill.htm.md)
