Example #1
0
        public FreeImage(string filename)
        {
            FreeImageFormat fif = FreeImageApi.GetFIFFromFilename(filename);

            if (fif == FreeImageFormat.Unknown)
            {
                throw new Exception("Unknown file format");
            }

            m_Handle = FreeImageApi.Load(fif, filename, 0);
            m_MemPtr = IntPtr.Zero;
        }
Example #2
0
        public bool Save(string filename)
        {
            if (File.Exists(filename))
            {
                File.Delete(filename);
            }

            FreeImageFormat fif = FreeImageApi.GetFIFFromFilename(filename);

            FreeImageApi.SetPluginEnabled(fif, true);

            return(FreeImageApi.Save(fif, m_Handle, filename, 0));
        }