public void SaveAdd() { string filename = @"saveadd.tif"; FreeImageBitmap fib = new FreeImageBitmap(100, 100, PixelFormat.Format24bppRgb); try { fib.SaveAdd(); Assert.Fail(); } catch { } Assert.IsFalse(File.Exists(filename)); fib.Save(filename); fib.AdjustBrightness(0.3d); fib.SaveAdd(); FreeImageBitmap other = new FreeImageBitmap(100, 100, PixelFormat.Format24bppRgb); foreach (Scanline <RGBTRIPLE> scanline in other) { for (int i = 0; i < scanline.Length; i++) { scanline[i] = new RGBTRIPLE(Color.FromArgb(0x339955)); } } fib.SaveAdd(other); other.SaveAdd(filename); other.Dispose(); fib.Dispose(); fib = new FreeImageBitmap(filename); Assert.AreEqual(4, fib.FrameCount); fib.Dispose(); File.Delete(filename); Assert.IsFalse(File.Exists(filename)); }
public static void Main(string[] args) { var icoFile = args[1]; var fiBitmap = new FreeImageBitmap(args[0]); var first = true; foreach (var size in Sizes) { if (fiBitmap.Width < size || fiBitmap.Height < size) { continue; } fiBitmap.Rescale(size, size, FREE_IMAGE_FILTER.FILTER_BICUBIC); if (first) { first = false; fiBitmap.Save(icoFile); } else { fiBitmap.SaveAdd(icoFile); } } }
public void SaveAdd() { string filename = @"saveadd.tif"; FreeImageBitmap fib = new FreeImageBitmap(100, 100, PixelFormat.Format24bppRgb); try { fib.SaveAdd(); Assert.Fail(); } catch { } Assert.IsFalse(File.Exists(filename)); fib.Save(filename); fib.AdjustBrightness(0.3d); fib.SaveAdd(); FreeImageBitmap other = new FreeImageBitmap(100, 100, PixelFormat.Format24bppRgb); foreach (Scanline<RGBTRIPLE> scanline in other) { for (int i = 0; i < scanline.Length; i++) { scanline[i] = new RGBTRIPLE(Color.FromArgb(0x339955)); } } fib.SaveAdd(other); other.SaveAdd(filename); other.Dispose(); fib.Dispose(); fib = new FreeImageBitmap(filename); Assert.AreEqual(4, fib.FrameCount); fib.Dispose(); File.Delete(filename); Assert.IsFalse(File.Exists(filename)); }