Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect picture format with SixLabors ImageSharp

Tags:

c#

imagesharp

How do I get the image format using SixLabors.ImageSharp?

In version 1.0.0-alpha9-00152 I could use:

Image<Rgba32> image = Image.Load(GetBytesFromBlobStorage());
IImageFormat format = image.CurrentImageFormat;

but .CurrentImageFormat() doesn't seen to be able in beta version 1.0.0-beta0001.

I want to know if the image is .png, .bmp or .jpeg.

like image 681
Andre Odendaal Avatar asked Oct 18 '17 09:10

Andre Odendaal


1 Answers

Yeah, we moved your cheese a little bit with 1.0.0-beta0001.

The signature you are looking for is now.

public static Image<TPixel> Load<TPixel>(Stream stream, out IImageFormat format)
like image 175
James South Avatar answered Sep 16 '22 11:09

James South