---
title: "CompressedImage.CreateFromStream Method (Stream)"
canonical: https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_CompressedImage_CreateFromStream_1_bca7c9fe.htm
product: "Graphics Mill"
---

# CompressedImage.CreateFromStream Method (Stream)
 
Creates a [CompressedImage](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_CompressedImage.htm.md) directly from a stream, keeping a PNG or JPEG source's encoded bytes as is instead of decoding and recompressing them.
 
**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
)
```
 
### Parameters
 
 - stream
     - Type: System.IO.Stream
A Stream containing the source image.
 
### Return Value
A new [CompressedImage](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_CompressedImage.htm.md) instance. Its [ColorStream](https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_CompressedImage_ColorStream.htm.md) reports [Png](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_CompressionType.htm.md) or [Jpeg](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_CompressionType.htm.md) to match the source; any other format falls back to decoding and re-compressing with [Zip](https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Codecs_CompressionType.htm.md).
   
## 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)
