With two controls a PictureBox and another "PictureBox like" , Pic2, a
control from a dll, I'm stuck on cannot implicity convert
System.Drawing. Image to System.Drawing. Bitmap error.
How do I convert the following code so that the Pic2 can accept the Image
from the stream where it wants Picture property not and Image property.
Here is a snippet, I'm trying to avoid writing to disk.:
Image i = Pic1.Image;
MemoryStream ms = new MemoryStream();
i.Save(ms, ImageFormat.Jpe g); // need to save in jpeg for Pic2
//Read from MemoryStream into Byte array.
Byte[] bytBLOBData = new Byte[ms.Length];
ms.Position = 0;
ms.Read(bytBLOB Data, 0, Convert.ToInt32 (ms.Length));
Pic2.Picture = Image.FromStrea m(ms); // this is the line throwing the
"cannot convert System.Drawing. Image to System.Drawing. Bitmap
Thanks any help would be appreciated,
--
Fritz 1 50581
Hi Fritz,
Introduce an intermediate variable like thi: ms.Read(bytBLOB Data, 0, Convert.ToInt32 (ms.Length));
Image img = Image.FromStrea m(ms);
Pic2.Picture = img;
And inspect the actual type of this "img" variable.
By the way, why is your assigment of one PictureBox's Image to another's is
so complicated?
--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE
"Fritz Switzer" <fr***********@ comcast.net> wrote in message
news:e2******** *****@TK2MSFTNG P11.phx.gbl... With two controls a PictureBox and another "PictureBox like" , Pic2, a control from a dll, I'm stuck on cannot implicity convert System.Drawing. Image to System.Drawing. Bitmap error.
How do I convert the following code so that the Pic2 can accept the Image from the stream where it wants Picture property not and Image property. Here is a snippet, I'm trying to avoid writing to disk.:
Image i = Pic1.Image;
MemoryStream ms = new MemoryStream();
i.Save(ms, ImageFormat.Jpe g); // need to save in jpeg for Pic2
//Read from MemoryStream into Byte array.
Byte[] bytBLOBData = new Byte[ms.Length];
ms.Position = 0;
ms.Read(bytBLOB Data, 0, Convert.ToInt32 (ms.Length));
Pic2.Picture = Image.FromStrea m(ms); // this is the line throwing
the "cannot convert System.Drawing. Image to System.Drawing. Bitmap
Thanks any help would be appreciated,
-- Fritz
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: News VS.NET \( MS ILM \) |
last post by:
Hello
I have the following:
Dim myBitmap As New Bitmap(600, 500)
Q:
How to convert a Bitmap to a Buffer() of Bytes
|
by: Daniel |
last post by:
I have looked everywhere on the web for an answer to this and the only
thing I can find is converting the image format when the file is
present on the local filesystem. What I want to do is use a web form
to upload a TIFF image (scanned images) and convert it to a JPEG
before I insert it into SQL Server. The file upload part works great,
but I can;t convert the image. I certainly don't want to upload it the
the server filesystem, convert...
|
by: Socrates |
last post by:
I am interested in developing an online utility that will enable users
to
copy and past any image (or upload any image on the internet) to the
online utility, which will then convert the image to text.
The user may "convert image to text" and copy and paste the text
displayed into any word document, or send the text displayed to the
recipient's email address or can download the text file as a zipped
text file that will be presented to...
|
by: stef |
last post by:
hello
I can find all kind of procedures to convert an array to a bitmap
(wxPython, PIL),
but I can't find the reverse,
either
- convert a bitmap to an array
or
- read a bitmap file to an array
|
by: gnkt4ujt2002 |
last post by:
how to convert image into hex format in vs.net 2003 ....bcoz i hav 2 send image on mobile using sms tgate way.. i hav a clickatell sms gate way...
| |
by: Peter Oliphant |
last post by:
The Image class allows loading a bitmap from a graphic file. So far I've
gotten it to work with JPG and BMP files.
What other graphic file formats are supported in this way? Is this fixed
based on the .NET Framework used (e.g., the Image class defines which
formats can be used), or can different file formats be added after-the-fact
(end-user capability in contrast to developer implementation)?
Also, is it possible to save an image in...
|
by: =?Utf-8?B?UmljYXJkbyBGdXJ0YWRv?= |
last post by:
I'm using OpenGL in Visual Basic .net 2005 and i need to use the following
function
glBitmap(width as integer,height as integer, xorig as single, yorig as
single, xmove as single, ymove as single, bitmap as System.InPtr)
or
glBitmap(width as integer,height as integer, xorig as single, yorig as
single, xmove as single, ymove as single, bitmap() as byte)
|
by: alarock |
last post by:
hi,
I have performed some drawing using Vector image,DrawRectangle etc... and then i converted to raster Image(bitmap)
i found in the zoomed raster image(bitmap) the outer boundary of the raster image(bitmap) is blurry. i used Interpolation mode,smoothing mode,,and tried a lot ..... i cant able to solve this problem in C#...Please help me to solve this......
Regards,
alarock(algates)
|
by: surajhs |
last post by:
hi,
I am working on java applet, i created a interface to view image in panel on jlist selected image item which is in local machine path, Now i need to convert image to xml and along with i will open image viewer add some annotations save it in that xml file. Please help me with sample code or links.
Thank you in advance
|
by: surajhs |
last post by:
i need to convert image to binary data and create xml file in applet, Please send samples links
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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();...
|
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...
| |
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |