Kostakis45
Active member
- Joined
- Apr 3, 2022
- Messages
- 37
- Programming Experience
- Beginner
So i guess this is a continuation to my previous post.
I'm trying to save a copied image (Clipboard) to my SQLite db via picturebox.
For now i can copy paste an image to picturebox with this code.
once it's pasted i guess the pictureBox is no more null.But when i try to save it to database it's throwing a ANE saying parameter name 'encoder'.See Picture.This happens when it's trying to convert the image to Bytes in this converter.
What am I missing?
I read that clipboard images gets RawBitmap format.Is that relative and if yes how i can resolve that?
I'm trying to save a copied image (Clipboard) to my SQLite db via picturebox.
For now i can copy paste an image to picturebox with this code.
Paste image to picturebox:
private void Get_Image_For_PicBox1(object sender, MouseEventArgs e)//Paste the picture to pictureBox1
{
if (e.Button == MouseButtons.Right)
{
pictureBox1.Image = Clipboard.GetImage();
pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
}
}
Image to Bytes Converter:
public byte[] ConvertImageToBytes(Image image)
{
using (var stream = new MemoryStream())
{
image.Save(stream, image.RawFormat);//ERROR IN THIS LINE
return stream.ToArray();
}
}
I read that clipboard images gets RawBitmap format.Is that relative and if yes how i can resolve that?
Last edited: