A
Alexander Vasilevsky
Hi,
there is a code
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.IO.Compression;
using System.Windows.Forms;
namespace TestImageTypeSize
{
class Program
{
static void Main()
{
ImageFormat[ ] formats = new[ ] { ImageFormat.Gif, ImageFormat.Jpeg,
ImageFormat.Png };
int screenId = 0;
foreach (Screen screen in Screen.AllScreens)
{
Bitmap bmp = new Bitmap(screen.Bounds.Width, screen.Bounds.Height);
Graphics g = Graphics.FromImage(bmp);
g.CopyFromScreen(screen.Bounds.X, screen.Bounds.Y, 0, 0, new
Size(screen.Bounds.Width, screen.Bounds.Height));
foreach (ImageFormat format in formats)
{
string filename = @"t:\screen_" + screenId + "." + format;
bmp.Save(filename, format);
FileStream fileStream = new FileStream(filename + ".zip",
FileMode.Create, FileAccess.ReadWrite);
GZipStream gZipStream = new GZipStream(fileStream,
CompressionMode.Compress);
bmp.Save(gZipStream, format);
gZipStream.Close();
}
screenId++;
}
}
}
}
which falls in line
bmp.Save(gZipStream, format);with exception
A generic error occurred in GDI+
What's error?
http://www.alvas.net - Audio tools for C# and VB.Net developers + Christmas
Gift
there is a code
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.IO.Compression;
using System.Windows.Forms;
namespace TestImageTypeSize
{
class Program
{
static void Main()
{
ImageFormat[ ] formats = new[ ] { ImageFormat.Gif, ImageFormat.Jpeg,
ImageFormat.Png };
int screenId = 0;
foreach (Screen screen in Screen.AllScreens)
{
Bitmap bmp = new Bitmap(screen.Bounds.Width, screen.Bounds.Height);
Graphics g = Graphics.FromImage(bmp);
g.CopyFromScreen(screen.Bounds.X, screen.Bounds.Y, 0, 0, new
Size(screen.Bounds.Width, screen.Bounds.Height));
foreach (ImageFormat format in formats)
{
string filename = @"t:\screen_" + screenId + "." + format;
bmp.Save(filename, format);
FileStream fileStream = new FileStream(filename + ".zip",
FileMode.Create, FileAccess.ReadWrite);
GZipStream gZipStream = new GZipStream(fileStream,
CompressionMode.Compress);
bmp.Save(gZipStream, format);
gZipStream.Close();
}
screenId++;
}
}
}
}
which falls in line
bmp.Save(gZipStream, format);with exception
A generic error occurred in GDI+
What's error?
http://www.alvas.net - Audio tools for C# and VB.Net developers + Christmas
Gift