new method: GetImageFormat
This commit is contained in:
parent
8adee2bfd9
commit
89f4b87ac1
|
@ -0,0 +1,31 @@
|
||||||
|
using System.Drawing.Imaging;
|
||||||
|
|
||||||
|
namespace Mk0.Tools.Images
|
||||||
|
{
|
||||||
|
public static class ImagesFormat
|
||||||
|
{
|
||||||
|
public static string GetImageFormat(this System.Drawing.Image img)
|
||||||
|
{
|
||||||
|
if (img.RawFormat.Equals(ImageFormat.Jpeg))
|
||||||
|
return ".jpg";
|
||||||
|
if (img.RawFormat.Equals(ImageFormat.Bmp))
|
||||||
|
return ".bmp";
|
||||||
|
if (img.RawFormat.Equals(ImageFormat.Png))
|
||||||
|
return ".png";
|
||||||
|
if (img.RawFormat.Equals(ImageFormat.Emf))
|
||||||
|
return ".emf";
|
||||||
|
if (img.RawFormat.Equals(ImageFormat.Exif))
|
||||||
|
return ".exif";
|
||||||
|
if (img.RawFormat.Equals(ImageFormat.Gif))
|
||||||
|
return ".gif";
|
||||||
|
if (img.RawFormat.Equals(ImageFormat.Icon))
|
||||||
|
return ".ico";
|
||||||
|
if (img.RawFormat.Equals(ImageFormat.MemoryBmp))
|
||||||
|
return ".mbp";
|
||||||
|
if (img.RawFormat.Equals(ImageFormat.Tiff))
|
||||||
|
return ".tif";
|
||||||
|
else
|
||||||
|
return ".wmf";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -39,6 +39,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="BorderCropper.cs" />
|
<Compile Include="BorderCropper.cs" />
|
||||||
<Compile Include="GetCopyImage.cs" />
|
<Compile Include="GetCopyImage.cs" />
|
||||||
|
<Compile Include="GetImageFormat.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="ResizeImage.cs" />
|
<Compile Include="ResizeImage.cs" />
|
||||||
<Compile Include="Resolution.cs" />
|
<Compile Include="Resolution.cs" />
|
||||||
|
|
|
@ -9,7 +9,7 @@ using System.Drawing.Imaging;
|
||||||
|
|
||||||
namespace Mk0.Tools.Images
|
namespace Mk0.Tools.Images
|
||||||
{
|
{
|
||||||
public class Resize
|
public class Resizer
|
||||||
{
|
{
|
||||||
public static Bitmap ResizeImage(Image image, int width, int height)
|
public static Bitmap ResizeImage(Image image, int width, int height)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue