Convert GUID to System.Drawing.Imaging.ImageFormat

I store information about images in a database - also their ImageFormat (jpeg, png, etc.).

Console.WriteLine(System.Drawing.Imaging.ImageFormat.Jpeg.Guid); Outputs: b96b3cae-0728-11d3-9d7b-0000f81ef32e 

I want to save this in the database as a GUID - and read from the database and get the associated ImageFormat.

How do I add the GUID b96b3cae-0728-11d3-9d7b-0000f81ef32e to System.Drawing.Imaging.ImageFormat.Jpeg.Guid

+4
source share
3 answers

You provide the System.Guid System.Drawing.Imaging.ImageFormat constructor , and you can read it using Guid .

A System.Guid has several constructors including a string .

+3
source

1) save the GUID in the database instead of JPEG

2) use the constructor:

 ImageFormat( Guid guid ) 
+1
source

Doesn't the ImageFormat constructor allow you to get ImageFormat by its manual?

0
source

Source: https://habr.com/ru/post/1305460/


All Articles