I am trying to convert an image to an byte array (tobytes() method) and from
byte array back to an image (frombytes() method). The problem i have here is
say the image size is 285 bytes but the total bytes is 635. I know it would
include the header but the header should be the same size regardless of the
image size. I tested the other image size of 407 bytes and the total bytes
array is 727. I am not sure what is wrong? your help would be appreciate
it. 8 11656
What is the image size and total size? How do you calculate the image size?
--
Stoitcho Goutsev (100)
"piggy" <pi***@discussi ons.microsoft.c omwrote in message
news:6F******** *************** ***********@mic rosoft.com...
>I am trying to convert an image to an byte array (tobytes() method) and from
byte array back to an image (frombytes() method). The problem i have here
is
say the image size is 285 bytes but the total bytes is 635. I know it
would
include the header but the header should be the same size regardless of
the
image size. I tested the other image size of 407 bytes and the total
bytes
array is 727. I am not sure what is wrong? your help would be appreciate
it.
Hi,
What is the problem with a variable size?
Just handle the entire array as one entity.
You can you use a MemoryStream to convert to/from byte
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"piggy" <pi***@discussi ons.microsoft.c omwrote in message
news:6F******** *************** ***********@mic rosoft.com...
>I am trying to convert an image to an byte array (tobytes() method) and from
byte array back to an image (frombytes() method). The problem i have here
is
say the image size is 285 bytes but the total bytes is 635. I know it
would
include the header but the header should be the same size regardless of
the
image size. I tested the other image size of 407 bytes and the total
bytes
array is 727. I am not sure what is wrong? your help would be appreciate
it.
If you have an image, you can have a file. If you have a file you have
a filestream. If you have a filestream you can get an array of bytes.
You might have to mess around with what streams you need, probably a
mix of FileStream and MemoryStream.
Ignacio Machin ( .NET/ C# MVP ) wrote:
Hi,
What is the problem with a variable size?
Just handle the entire array as one entity.
You can you use a MemoryStream to convert to/from byte
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"piggy" <pi***@discussi ons.microsoft.c omwrote in message
news:6F******** *************** ***********@mic rosoft.com...
I am trying to convert an image to an byte array (tobytes() method) and
from
byte array back to an image (frombytes() method). The problem i have here
is
say the image size is 285 bytes but the total bytes is 635. I know it
would
include the header but the header should be the same size regardless of
the
image size. I tested the other image size of 407 bytes and the total
bytes
array is 727. I am not sure what is wrong? your help would be appreciate
it.
piggy wrote:
I am trying to convert an image to an byte array (tobytes() method) and
from
byte array back to an image (frombytes() method). The problem i have here
is
say the image size is 285 bytes but the total bytes is 635. I know it
would include the header but the header should be the same size regardless
of the
image size. I tested the other image size of 407 bytes and the total
bytes
array is 727. I am not sure what is wrong? your help would be appreciate
it.
Hi Piggy,
Can you post some code, demonstrating what you are doing, and how you are
obtaining 'image size' and 'total bytes'?
--
Hope this helps,
Tom Spink
Google first, ask later.
Your Image Class sports a Save and a FromStream method, both of which can
work with a stream such as a MemoryStream. MemoryStream class has a
contructor overload that accepts a byte array, and it has a ToArray method
that gives you back a byte array. The header (Jpeg, gif, etc is simply part
of this array and you should not need to worry about it at all.
Hope that helps,
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"piggy" wrote:
I am trying to convert an image to an byte array (tobytes() method) and from
byte array back to an image (frombytes() method). The problem i have here is
say the image size is 285 bytes but the total bytes is 635. I know it would
include the header but the header should be the same size regardless of the
image size. I tested the other image size of 407 bytes and the total bytes
array is 727. I am not sure what is wrong? your help would be appreciate
it.
The problem is that we try to send as small as package size over the network
as possible. I am just curious. If that is how it works and there are no
ways to fix it then have to accept it. Thanks for your comments.
"Peter Bromberg [C# MVP]" wrote:
Your Image Class sports a Save and a FromStream method, both of which can
work with a stream such as a MemoryStream. MemoryStream class has a
contructor overload that accepts a byte array, and it has a ToArray method
that gives you back a byte array. The header (Jpeg, gif, etc is simply part
of this array and you should not need to worry about it at all.
Hope that helps,
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"piggy" wrote:
I am trying to convert an image to an byte array (tobytes() method) and from
byte array back to an image (frombytes() method). The problem i have here is
say the image size is 285 bytes but the total bytes is 635. I know it would
include the header but the header should be the same size regardless of the
image size. I tested the other image size of 407 bytes and the total bytes
array is 727. I am not sure what is wrong? your help would be appreciate
it.
i don't calculate the image size. I just check the image size from window
explorer. Is there a way to do it?
"Stoitcho Goutsev (100)" wrote:
What is the image size and total size? How do you calculate the image size?
--
Stoitcho Goutsev (100)
"piggy" <pi***@discussi ons.microsoft.c omwrote in message
news:6F******** *************** ***********@mic rosoft.com...
I am trying to convert an image to an byte array (tobytes() method) and
from
byte array back to an image (frombytes() method). The problem i have here
is
say the image size is 285 bytes but the total bytes is 635. I know it
would
include the header but the header should be the same size regardless of
the
image size. I tested the other image size of 407 bytes and the total
bytes
array is 727. I am not sure what is wrong? your help would be appreciate
it.
I agree that header is a part of the array but shoudn't it be the same size
regarless of the image size? It will be different depending on the image
type as well.
"piggy" wrote:
The problem is that we try to send as small as package size over the network
as possible. I am just curious. If that is how it works and there are no
ways to fix it then have to accept it. Thanks for your comments.
"Peter Bromberg [C# MVP]" wrote:
Your Image Class sports a Save and a FromStream method, both of which can
work with a stream such as a MemoryStream. MemoryStream class has a
contructor overload that accepts a byte array, and it has a ToArray method
that gives you back a byte array. The header (Jpeg, gif, etc is simply part
of this array and you should not need to worry about it at all.
Hope that helps,
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"piggy" wrote:
I am trying to convert an image to an byte array (tobytes() method) and from
byte array back to an image (frombytes() method). The problem i have here is
say the image size is 285 bytes but the total bytes is 635. I know it would
include the header but the header should be the same size regardless of the
image size. I tested the other image size of 407 bytes and the total bytes
array is 727. I am not sure what is wrong? your help would be appreciate
it.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: PHS |
last post by:
I have a c# client application that connects to a network socket. When
connected, the listener sends a network stream containing bitmap, jpeg, data
from a file nominated by the client. The client application (also c#)
receives the data into a byte array. I want to pass the byte array
directly to a picture control on the form. I can't find a way to do this so I
used a file stream and write the byte array to a file, and then pass that...
|
by: Swarup |
last post by:
I am reading a file (txt, xml, gif, ico, bmp etc) byte by byte and filling
it into a byte arry. Now i have to convert it into a string to store it in
the database.
I use
System.Text.UnicodeEncoding enc = new System.Text.UnicodeEncoding();
now i am using enc.GetString(value) and the value retured is one byte less
if the size of the byte array is Odd. In case of files having even number
of bytes, the convertion is happening correctly and...
|
by: Fritz Switzer |
last post by:
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;
|
by: Clas Hortien |
last post by:
Hi,
i have a array of uint and want to display this array as a
System.Web.UI.WebControls.Image.
//=========================================
uint ar = new uint;
string fName;
|
by: Rob T |
last post by:
Hi, I'm trying to convert his line from C# to VB:
System.Drawing.Image _img=
System.Drawing.Image.FromStream(new
System.IO.MemoryStream((byte)SqlReader);
I have this so far:
dim Img as SystemDrawing.Image
Img=System.Drawing.Image.FromStream(new
System.IO.MemoryStream(Convert.ToByte(SqlReader("Image"))))
| |
by: Dennis |
last post by:
I am trying to convert a bitmap to a JPEG MemoryStream and return a Byte
array containing the resulting JPEG Image as follows:
Public Function BmpToJPEG(ByVal BitMapIn As Bitmap, ByVal Quality As Long)
As Byte()
'find the encoder with the image/jpeg mime-type
dim codecs as ImageCodecInfo = ImageCodecInfo.GetImageEncoders()
Dim ici As ImageCodecInfo
For Each codec As ImageCodecInfo In codecs
If (codec.MimeType = "image/jpeg") Then
|
by: Trammel |
last post by:
Hi, I have a vb.net program made to grab screenshots and then store them in
image objects.
The image is displayed in a pictureBox atm but I want to store the data in a
String only.
(Without saving to a file on HDD, then loading it as binary)
Does anyone know how to convert an image into a string & have any pointers
to information on how the image would look when in the string (Like bit
patterns, etc)?
|
by: minouparhizkar |
last post by:
hi could anyone helping me to finish this i have no idea how to implement the program in java im trying to grabbing the pixel from image and then convert it to the txt file .i did that but it didnt give me back any result
could you tell me whats wrong with that.
here is the pixel grabber file:
package digitalpen;
import java.awt.image.*;
|
by: Debadatta Mishra |
last post by:
Introduction
In this article I will provide you an approach to manipulate an image file. This article gives you an insight into some tricks in java so that you can conceal sensitive information inside an image, hide your complete image as text ,search for a particular image inside a directory, minimize the size of the image. However this is not a new concept, there is a concept called Steganography which enables to conceal your secret...
|
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...
|
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: 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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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
| |