473,714 Members | 2,500 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to save to a bitmap?

Lee
I have the following code
using System;
using System.Windows. Forms;
using System.Drawing;
using System.Collecti ons;
namespace FINN
{

public class flickerFreePict ureBox : PictureBox
{
public ArrayList Lines = new ArrayList();
public flickerFreePict ureBox()
{

this.SetStyle(C ontrolStyles.Do ubleBuffer, true);
this.SetStyle (ControlStyles. AllPaintingInWm Paint, true);
this.SetStyle(C ontrolStyles.Us erPaint, true);
this.SetStyle(C ontrolStyles.Re sizeRedraw, true);
//this.MouseMove += new MouseEventHandl er(_MouseMove);
}
protected override void OnPaint(PaintEv entArgs e)
{
bool error = false;
//e.Graphics.Smoo thingMode = SmoothingMode.A ntiAlias;
try
{
foreach(scribbl eObject al in Lines)
{
bool Drawdot = false;
try
{
Point[] linelist = new Point[
al.linePosition s.Count];

al.linePosition s.CopyTo(0,line list,0,al.lineP ositions.Count) ;
e.Graphics.Draw Lines(al.pen(), linelist);
}
catch
{
Drawdot = true; //we want to draw a dot
}
if(Drawdot)
{
//Draw a single dot as the user has only
clicked, rather than clicked and dragged
//TODO: Draw a dot
}

}
}
catch
{
error = true;
}
if(error)
{
//this.OnPaint(e) ;
}
}
}

}

And I would like to be able to create a bitmap of what gets drawn in
OnPaint so that I can save it to file, I've tried a few things, but so
far just ended up with black bitmaps the same size as the control that
code creates, any suggestions or code snippets would be a great help.

Cheers

Lee

Oct 24 '06 #1
12 4035
Hi Lee

Before Bob Powell notices you are using a PictureBox for drawing, you
should read the GDI+ FAQ. Specifically the article regarding PictureBox

http://www.bobpowell.net/pictureboxhowto.htm

As for saving the Bitmap you could inside your Paint procedure separate
actual drawing to a method that you pass either the Paint graphics object,
or a Bitmap graphics object, otherwise refer to the FAQ

--
Happy Coding!
Morten Wennevik [C# MVP]
Oct 24 '06 #2
Lee
I've done the following

In OnPaint added this

Bitmap bmp = new Bitmap(this.Wid th, this.Height);
Graphics g = Graphics.FromIm age(bmp);

Then for my painting method, simply duplicated it so that it paints to
g as well.
Now I get a nice black bitmap and not a lot else :(

Thanks for the link to the FAQ but I'm not sure how I can refactor my
current code to make use of it, due to deadlines I think it might have
to wait for the next project.

Cheers

Morten Wennevik wrote:
Hi Lee

Before Bob Powell notices you are using a PictureBox for drawing, you
should read the GDI+ FAQ. Specifically the article regarding PictureBox

http://www.bobpowell.net/pictureboxhowto.htm

As for saving the Bitmap you could inside your Paint procedure separate
actual drawing to a method that you pass either the Paint graphics object,
or a Bitmap graphics object, otherwise refer to the FAQ

--
Happy Coding!
Morten Wennevik [C# MVP]
Oct 24 '06 #3
Graphics g = Graphics.FromIm age(bmp);

The above line is good.
Therefore do you then do all of the drawing with THAT graphics object?
Then after the drawing has finished save the bitmap (bmp) to disk?

That (from what I recall) should do the trick.

Simon Tamman

"Lee" <lv******@gmail .comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
I've done the following

In OnPaint added this

Bitmap bmp = new Bitmap(this.Wid th, this.Height);
Graphics g = Graphics.FromIm age(bmp);

Then for my painting method, simply duplicated it so that it paints to
g as well.
Now I get a nice black bitmap and not a lot else :(

Thanks for the link to the FAQ but I'm not sure how I can refactor my
current code to make use of it, due to deadlines I think it might have
to wait for the next project.

Cheers

Morten Wennevik wrote:
Hi Lee

Before Bob Powell notices you are using a PictureBox for drawing, you
should read the GDI+ FAQ. Specifically the article regarding PictureBox

http://www.bobpowell.net/pictureboxhowto.htm

As for saving the Bitmap you could inside your Paint procedure separate
actual drawing to a method that you pass either the Paint graphics
object,
or a Bitmap graphics object, otherwise refer to the FAQ

--
Happy Coding!
Morten Wennevik [C# MVP]

Oct 24 '06 #4
Lee
Yep that is exactly what I'm doing, but all I get back is a black
bitmap.

I've tried also: Graphics g = Graphics.FromIm age(this.Image) ;

which yeilds the same results

Simon Tamman wrote:
Graphics g = Graphics.FromIm age(bmp);

The above line is good.
Therefore do you then do all of the drawing with THAT graphics object?
Then after the drawing has finished save the bitmap (bmp) to disk?

That (from what I recall) should do the trick.

Simon Tamman

"Lee" <lv******@gmail .comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
I've done the following

In OnPaint added this

Bitmap bmp = new Bitmap(this.Wid th, this.Height);
Graphics g = Graphics.FromIm age(bmp);

Then for my painting method, simply duplicated it so that it paints to
g as well.
Now I get a nice black bitmap and not a lot else :(

Thanks for the link to the FAQ but I'm not sure how I can refactor my
current code to make use of it, due to deadlines I think it might have
to wait for the next project.

Cheers

Morten Wennevik wrote:
Hi Lee
>
Before Bob Powell notices you are using a PictureBox for drawing, you
should read the GDI+ FAQ. Specifically the article regarding PictureBox
>
http://www.bobpowell.net/pictureboxhowto.htm
>
As for saving the Bitmap you could inside your Paint procedure separate
actual drawing to a method that you pass either the Paint graphics
object,
or a Bitmap graphics object, otherwise refer to the FAQ
>
--
Happy Coding!
Morten Wennevik [C# MVP]
Oct 24 '06 #5
Lee
Got it working, here is the entire code
using System;
using System.Windows. Forms;
using System.Drawing;
using System.Collecti ons;
namespace FINN
{

public class flickerFreePict ureBox : PictureBox
{
public ArrayList Lines = new ArrayList();
public Bitmap bmp;
private Graphics g;
public flickerFreePict ureBox()
{
bmp = new Bitmap(800, 310);
g = Graphics.FromIm age(bmp);
g.FillRectangle (System.Drawing .Brushes.White, 0,0, 800, 310);
this.SetStyle(C ontrolStyles.Do ubleBuffer, true);
this.SetStyle(C ontrolStyles.Al lPaintingInWmPa int, true);
this.SetStyle(C ontrolStyles.Us erPaint, true);
this.SetStyle(C ontrolStyles.Re sizeRedraw, true);
//this.MouseMove += new MouseEventHandl er(_MouseMove);

}
protected override void OnPaint(PaintEv entArgs e)
{
bool error = false;

//e.Graphics.Smoo thingMode = SmoothingMode.A ntiAlias;
try
{
foreach(scribbl eObject al in Lines)
{
bool Drawdot = false;
try
{
Point[] linelist = new Point[al.linePosition s.Count];
al.linePosition s.CopyTo(0,line list,0,al.lineP ositions.Count) ;

e.Graphics.Draw Lines(al.pen(), linelist);
g.DrawLines(al. pen(), linelist);

}
catch
{
Drawdot = true; //we want to draw a dot
}
if(Drawdot)
{
//Draw a single dot as the user has only clicked, rather than
clicked and dragged
//TODO: Draw a dot
}
}
}
catch
{
error = true;
}
if(error)
{
//this.OnPaint(e) ;
}
bmp.Save("Test. bmp");

}
}

}
I know there are magic numbers in there, but for some reason
'this.Width' etc wasn't working when I tried it on the setup, got too
many other things to do to refine it, but if I get some time I'll make
it neater, cheers for your help all
Lee wrote:
Yep that is exactly what I'm doing, but all I get back is a black
bitmap.

I've tried also: Graphics g = Graphics.FromIm age(this.Image) ;

which yeilds the same results

Simon Tamman wrote:
Graphics g = Graphics.FromIm age(bmp);

The above line is good.
Therefore do you then do all of the drawing with THAT graphics object?
Then after the drawing has finished save the bitmap (bmp) to disk?

That (from what I recall) should do the trick.

Simon Tamman

"Lee" <lv******@gmail .comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
I've done the following
>
In OnPaint added this
>
Bitmap bmp = new Bitmap(this.Wid th, this.Height);
Graphics g = Graphics.FromIm age(bmp);
>
Then for my painting method, simply duplicated it so that it paints to
g as well.
Now I get a nice black bitmap and not a lot else :(
>
Thanks for the link to the FAQ but I'm not sure how I can refactor my
current code to make use of it, due to deadlines I think it might have
to wait for the next project.
>
Cheers
>
Morten Wennevik wrote:
Hi Lee

Before Bob Powell notices you are using a PictureBox for drawing, you
should read the GDI+ FAQ. Specifically the article regarding PictureBox

http://www.bobpowell.net/pictureboxhowto.htm

As for saving the Bitmap you could inside your Paint procedure separate
actual drawing to a method that you pass either the Paint graphics
object,
or a Bitmap graphics object, otherwise refer to the FAQ

--
Happy Coding!
Morten Wennevik [C# MVP]
>
Oct 24 '06 #6
Eh?

Open a new windows project, drop a picture box onto the form and paste the
following code in.
That should work.
This code not only saves the file to disk (c:\test.bmp) but also reloads it
from disk to the picturebox and works fine for me.

Then track back from this code onto your code and see where you're going
wrong.

private string path = "c:\\test.b mp";

public Form1()
{
InitializeCompo nent();
this.Load += new EventHandler(Fo rm1_Load);
}

void Form1_Load(obje ct sender, EventArgs e)
{
using (Bitmap b = new Bitmap(100, 100))
{
using (Graphics g = Graphics.FromIm age(b))
{
using (SolidBrush sb = new SolidBrush(Colo r.Red))
{
g.FillRectangle (sb, 0, 0, 50, 50);
}
using (SolidBrush sb = new SolidBrush(Colo r.Green))
{
g.FillRectangle (sb, 50, 50, 50, 50);
}
b.Save(path, System.Drawing. Imaging.ImageFo rmat.Bmp);
}
}
LoadBitmap();
}

private void LoadBitmap()
{
Bitmap b = (Bitmap)Bitmap. FromFile(path);
this.pictureBox 1.Image = b;
}

"Lee" <lv******@gmail .comwrote in message
news:11******** **************@ m73g2000cwd.goo glegroups.com.. .
Yep that is exactly what I'm doing, but all I get back is a black
bitmap.

I've tried also: Graphics g = Graphics.FromIm age(this.Image) ;

which yeilds the same results

Simon Tamman wrote:
Graphics g = Graphics.FromIm age(bmp);

The above line is good.
Therefore do you then do all of the drawing with THAT graphics object?
Then after the drawing has finished save the bitmap (bmp) to disk?

That (from what I recall) should do the trick.

Simon Tamman

"Lee" <lv******@gmail .comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
I've done the following
>
In OnPaint added this
>
Bitmap bmp = new Bitmap(this.Wid th, this.Height);
Graphics g = Graphics.FromIm age(bmp);
>
Then for my painting method, simply duplicated it so that it paints to
g as well.
Now I get a nice black bitmap and not a lot else :(
>
Thanks for the link to the FAQ but I'm not sure how I can refactor my
current code to make use of it, due to deadlines I think it might have
to wait for the next project.
>
Cheers
>
Morten Wennevik wrote:
Hi Lee

Before Bob Powell notices you are using a PictureBox for drawing,
you
should read the GDI+ FAQ. Specifically the article regarding
PictureBox

http://www.bobpowell.net/pictureboxhowto.htm

As for saving the Bitmap you could inside your Paint procedure
separate
actual drawing to a method that you pass either the Paint graphics
object,
or a Bitmap graphics object, otherwise refer to the FAQ

--
Happy Coding!
Morten Wennevik [C# MVP]
>

Oct 24 '06 #7
Glad to hear you got it working.
I'd re-iterate Morten's advice, Bob Powells GDI+ FAQ is a great FAQ to read
on this kind of thing.

Additionally i'd watch out for the way you're performing the painting the
segment, performing a try catch to determine the user's action is a BAD way
to work things out you'd be better off working out what the user did without
using exceptions.
Secondly I know you currently have it commented out but calling OnPaint
within OnPaint is scary recursion which will lead you into the badness of
StackOverflowEx ceptions.

I'd recommend reading:
http://www.amazon.co.uk/Framework-De.../dp/0321246756
for a better understanding of exception handling (it has an excellent
chapter on it), it's also a pretty good book for plenty of other reasons.

HTH

Simon
"Lee" <lv******@gmail .comwrote in message
news:11******** *************@e 3g2000cwe.googl egroups.com...
Got it working, here is the entire code
using System;
using System.Windows. Forms;
using System.Drawing;
using System.Collecti ons;
namespace FINN
{

public class flickerFreePict ureBox : PictureBox
{
public ArrayList Lines = new ArrayList();
public Bitmap bmp;
private Graphics g;
public flickerFreePict ureBox()
{
bmp = new Bitmap(800, 310);
g = Graphics.FromIm age(bmp);
g.FillRectangle (System.Drawing .Brushes.White, 0,0, 800, 310);
this.SetStyle(C ontrolStyles.Do ubleBuffer, true);
this.SetStyle(C ontrolStyles.Al lPaintingInWmPa int, true);
this.SetStyle(C ontrolStyles.Us erPaint, true);
this.SetStyle(C ontrolStyles.Re sizeRedraw, true);
//this.MouseMove += new MouseEventHandl er(_MouseMove);

}
protected override void OnPaint(PaintEv entArgs e)
{
bool error = false;

//e.Graphics.Smoo thingMode = SmoothingMode.A ntiAlias;
try
{
foreach(scribbl eObject al in Lines)
{
bool Drawdot = false;
try
{
Point[] linelist = new Point[al.linePosition s.Count];
al.linePosition s.CopyTo(0,line list,0,al.lineP ositions.Count) ;

e.Graphics.Draw Lines(al.pen(), linelist);
g.DrawLines(al. pen(), linelist);

}
catch
{
Drawdot = true; //we want to draw a dot
}
if(Drawdot)
{
//Draw a single dot as the user has only clicked, rather than
clicked and dragged
//TODO: Draw a dot
}
}
}
catch
{
error = true;
}
if(error)
{
//this.OnPaint(e) ;
}
bmp.Save("Test. bmp");

}
}

}
I know there are magic numbers in there, but for some reason
'this.Width' etc wasn't working when I tried it on the setup, got too
many other things to do to refine it, but if I get some time I'll make
it neater, cheers for your help all
Lee wrote:
Yep that is exactly what I'm doing, but all I get back is a black
bitmap.

I've tried also: Graphics g = Graphics.FromIm age(this.Image) ;

which yeilds the same results

Simon Tamman wrote:
Graphics g = Graphics.FromIm age(bmp);
>
The above line is good.
Therefore do you then do all of the drawing with THAT graphics object?
Then after the drawing has finished save the bitmap (bmp) to disk?
>
That (from what I recall) should do the trick.
>
Simon Tamman
>
"Lee" <lv******@gmail .comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
I've done the following

In OnPaint added this

Bitmap bmp = new Bitmap(this.Wid th, this.Height);
Graphics g = Graphics.FromIm age(bmp);

Then for my painting method, simply duplicated it so that it paints
to
g as well.
Now I get a nice black bitmap and not a lot else :(

Thanks for the link to the FAQ but I'm not sure how I can refactor
my
current code to make use of it, due to deadlines I think it might
have
to wait for the next project.

Cheers

Morten Wennevik wrote:
Hi Lee
>
Before Bob Powell notices you are using a PictureBox for drawing,
you
should read the GDI+ FAQ. Specifically the article regarding
PictureBox
>
http://www.bobpowell.net/pictureboxhowto.htm
>
As for saving the Bitmap you could inside your Paint procedure
separate
actual drawing to a method that you pass either the Paint graphics
object,
or a Bitmap graphics object, otherwise refer to the FAQ
>
--
Happy Coding!
Morten Wennevik [C# MVP]

Oct 24 '06 #8
Lee
OnPaint is commented out for exactly that reason! :-)

I agree with you on the try/catch.

I'm fully aware that the code is a horrible hack, it was written months
ago and was my first real attempt and dealing with System.Drawing et
al. Unfortunately deadlines loom and I don't have time to refactor
it...

The moral of the story: get it right the first time.

Simon Tamman wrote:
Glad to hear you got it working.
I'd re-iterate Morten's advice, Bob Powells GDI+ FAQ is a great FAQ to read
on this kind of thing.

Additionally i'd watch out for the way you're performing the painting the
segment, performing a try catch to determine the user's action is a BAD way
to work things out you'd be better off working out what the user did without
using exceptions.
Secondly I know you currently have it commented out but calling OnPaint
within OnPaint is scary recursion which will lead you into the badness of
StackOverflowEx ceptions.

I'd recommend reading:
http://www.amazon.co.uk/Framework-De.../dp/0321246756
for a better understanding of exception handling (it has an excellent
chapter on it), it's also a pretty good book for plenty of other reasons.

HTH

Simon
"Lee" <lv******@gmail .comwrote in message
news:11******** *************@e 3g2000cwe.googl egroups.com...
Got it working, here is the entire code
using System;
using System.Windows. Forms;
using System.Drawing;
using System.Collecti ons;
namespace FINN
{

public class flickerFreePict ureBox : PictureBox
{
public ArrayList Lines = new ArrayList();
public Bitmap bmp;
private Graphics g;
public flickerFreePict ureBox()
{
bmp = new Bitmap(800, 310);
g = Graphics.FromIm age(bmp);
g.FillRectangle (System.Drawing .Brushes.White, 0,0, 800, 310);
this.SetStyle(C ontrolStyles.Do ubleBuffer, true);
this.SetStyle(C ontrolStyles.Al lPaintingInWmPa int, true);
this.SetStyle(C ontrolStyles.Us erPaint, true);
this.SetStyle(C ontrolStyles.Re sizeRedraw, true);
//this.MouseMove += new MouseEventHandl er(_MouseMove);

}
protected override void OnPaint(PaintEv entArgs e)
{
bool error = false;

//e.Graphics.Smoo thingMode = SmoothingMode.A ntiAlias;
try
{
foreach(scribbl eObject al in Lines)
{
bool Drawdot = false;
try
{
Point[] linelist = new Point[al.linePosition s.Count];
al.linePosition s.CopyTo(0,line list,0,al.lineP ositions.Count) ;

e.Graphics.Draw Lines(al.pen(), linelist);
g.DrawLines(al. pen(), linelist);

}
catch
{
Drawdot = true; //we want to draw a dot
}
if(Drawdot)
{
//Draw a single dot as the user has only clicked, rather than
clicked and dragged
//TODO: Draw a dot
}
}
}
catch
{
error = true;
}
if(error)
{
//this.OnPaint(e) ;
}
bmp.Save("Test. bmp");

}
}

}
I know there are magic numbers in there, but for some reason
'this.Width' etc wasn't working when I tried it on the setup, got too
many other things to do to refine it, but if I get some time I'll make
it neater, cheers for your help all
Lee wrote:
Yep that is exactly what I'm doing, but all I get back is a black
bitmap.
>
I've tried also: Graphics g = Graphics.FromIm age(this.Image) ;
>
which yeilds the same results
>
Simon Tamman wrote:
Graphics g = Graphics.FromIm age(bmp);

The above line is good.
Therefore do you then do all of the drawing with THAT graphics object?
Then after the drawing has finished save the bitmap (bmp) to disk?

That (from what I recall) should do the trick.

Simon Tamman

"Lee" <lv******@gmail .comwrote in message
news:11******** **************@ b28g2000cwb.goo glegroups.com.. .
I've done the following
>
In OnPaint added this
>
Bitmap bmp = new Bitmap(this.Wid th, this.Height);
Graphics g = Graphics.FromIm age(bmp);
>
Then for my painting method, simply duplicated it so that it paints
to
g as well.
Now I get a nice black bitmap and not a lot else :(
>
Thanks for the link to the FAQ but I'm not sure how I can refactor
my
current code to make use of it, due to deadlines I think it might
have
to wait for the next project.
>
Cheers
>
Morten Wennevik wrote:
Hi Lee

Before Bob Powell notices you are using a PictureBox for drawing,
you
should read the GDI+ FAQ. Specifically the article regarding
PictureBox

http://www.bobpowell.net/pictureboxhowto.htm

As for saving the Bitmap you could inside your Paint procedure
separate
actual drawing to a method that you pass either the Paint graphics
object,
or a Bitmap graphics object, otherwise refer to the FAQ

--
Happy Coding!
Morten Wennevik [C# MVP]
>
Oct 24 '06 #9
On 2006-10-24, Lee <lv******@gmail .comwrote:
public class flickerFreePict ureBox : PictureBox

Assuming you have an instance named myFlickerFreePi ctureBox:

int width = myFlickerFreePi ctureBox.Width;
int height = myFlickerFreePi ctureBox.Height ;

Bitmap bitmap = new Bitmap(width, height);
myFlickerFreePi ctureBox.DrawTo Bitmap(bitmap, new Rectangle(0, 0, width, height));

bitmap.Save(@"C :\somewhere.gif ", ImageFormat.Gif );
--
Met vriendelijke groeten,
Tim Van Wassenhove <http://www.timvw.be>
Oct 24 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
61747
by: charsh | last post by:
Hi, I using the code below to draw a text in a pictureBox1. //Start--------------------------------------------------------------- private void button1_Click(object sender, System.EventArgs e) { Graphics g; g = pictureBox1.CreateGraphics(); g.FillRectangle(Brushes.White,0,0,160,160);
9
2642
by: Mark Johnson | last post by:
How can you save all or a portion of the Grafics object to a Image/Bitmap ? I am try to save the Images from Cards.dll to a BitMap file. I can read in the Images to the Grafics, but when I try this with a Bitmap the results are Black. Can you somehow Clip the Grafic and Paste it into the Bitmap ? Mark Johnson, Berlin Germany mj10777@mj10777.de
12
57294
by: yaya via DotNetMonster.com | last post by:
Hi, I have a picture box with circles and rectangles, and I wana save all the images into a jpg file, i tried pictureBox1.Image.Save(@"c:\1.jpg"); but I got and error "System.NullReferenceException: Object reference not set to an instance of an object." Can anyone help? Thanks... --
2
4097
by: Olaf Baeyens | last post by:
I want to convert one bitmap file to another one. For example load as bmp and save as jpg. The loading part is simple I do this: Stream BitmapStream = File.Open(sSrcFile,FileMode.Open,FileAccess.Read,FileShare.None); Bitmap imgPhoto=new Bitmap(BitmapStream); iPixelsX=imgPhoto.Width; iPixelsY=imgPhoto.Height; BitmapStream.Close();
2
1676
by: Peter Proost | last post by:
Hi group when save a bitmap called saveBmp like this: <<<< saveBmp.Save(filename, ImageFormat.Jpeg) <<<< the bitmap gets saved with it's size propertys, so if I right click the file and select propertys I can see the width and the height of the image. But if I save the bitmap as a bitmap:
1
6495
by: WB | last post by:
Hi, I have a helper class that has a method to resize images. It takes the virtual path of an image and resize it to a specified dimension like this. public void ResizeImageTest(string pathImage, int newDimension) { string pathImageOnDisk = System.Web.HttpContext.Current.Server.MapPath(pathImage); System.IO.FileStream fs = new System.IO.FileStream(pathImageOnDisk,
1
3454
by: Stedak | last post by:
I have the following class I use to save Tiff's. The problem I have with it is that the final size of the images are very large. If we scan directly to a file the final tiff may be 600-900 kb.s but with this code it is often 4000-5000 kb.s. What am I missing? public class EmrTiff : IDisposable { private string fileName; private ArrayList imageContainer = null;
13
2300
by: Joe | last post by:
does anyone know why this source code throws an error?? Dim myBitmap As System.Drawing.Bitmap Dim myGraphics As Graphics myBitmap = New System.Drawing.Bitmap(fileName:="C:\test.tif") myGraphics = PictureBox1.CreateGraphics Dim expansionRectangle As New Rectangle(25, 550, 1000, 350) Dim destRectangle1 As New Rectangle(0, 0, 1000, 350) myGraphics.DrawImage(myBitmap, destRectangle1, expansionRectangle,
2
3861
by: Piotrekk | last post by:
Hi I have a problem. I open bitmap file, load it to memory decrease color palette by proceeding Euclidean distance. As a result i have image reduced to - for example 18 colors. Once i save it - Bitmap.Save(filename) reopen and check color of every pixel it seems that there are over 41000 of different pixel colors. I need to save it in such a way that there will be exactly 18 colors in a file. It seems i have problem with it... Can...
0
8801
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9314
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9074
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6634
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5947
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4464
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3158
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2520
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2110
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.