Пример #1
0
 /// <summary>
 /// Convert a .tga file to .png
 /// </summary>
 /// <param name="file">Input file</param>
 /// <param name="output">Output folder</param>
 public static void ConvertToPng(String file, String output)
 {
     try
     {
         String _file = Path.GetFileNameWithoutExtension(file);
         TargaImage _image = new TargaImage(file);
         _image.Image.Save(output + "\\" + _file + ".png", ImageFormat.Png);
         _image.Dispose();
     }
     catch (Exception) { }
 }
Пример #2
0
        /// <summary>
        /// Loads a Targa image file into a Bitmap object.
        /// </summary>
        /// <param name="sFileName">The Targa image filename</param>
        /// <returns>A Bitmap object with the Targa image loaded into it.</returns>
        public static Bitmap LoadTargaImage(string sFileName)
        {
            Bitmap b = null;
            using (TargaImage ti = new TargaImage(sFileName))
            {
                b = new Bitmap(ti.Image);
            }

            return b;
        }