CSharp examples for System.Drawing:Image Effect
Determines if a Path is a path to an image file
// Copyright (c) .NET Foundation. All rights reserved. using OpenLiveWriter.Interop.Windows; using System.Text; using System.Runtime.InteropServices; using System.IO;// w w w . j a v a 2 s. co m using System.Globalization; using System.Collections; using System; public class Main{ /// <summary> /// Determines if a Path is a path to an image file /// </summary> /// <param name="path">the path to check</param> /// <returns>true if the path is to an image file, otherwise false</returns> public static bool IsPathImage(string path) { switch (Path.GetExtension(path).ToUpperInvariant()) { case ".GIF": case ".JPG": case ".PNG": case ".JPEG": case ".TIF": case ".TIFF": case ".BMP": return true; } return false; } }