By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,169 Members | 1,705 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,169 IT Pros & Developers. It's quick & easy.

How to display an image?

P: n/a
I create my own file format that could content many image files (jpg, ico,
....) . I can get the data of each image, and I want to display it on the
form. How can?
I've tried to create a file with the image data I want to show and open it
with that file name. No problem about this way. But I don't think it a good
way
Could anybody help me with another solution?
Nov 16 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi Dean,
Create a stream for each image and pass that stream to the Bitmap class'
constructor. I don't know your file format, but if you can't use the
original file stream you probably should create a memory stream then
transfer the image bytes form the file and pass that stream to the Bitmap's
constructor.
"Dean L. Howen" <co*****@hotpop.com> wrote in message
news:eI*************@TK2MSFTNGP15.phx.gbl...
I create my own file format that could content many image files (jpg, ico,
...) . I can get the data of each image, and I want to display it on the
form. How can?
I've tried to create a file with the image data I want to show and open it
with that file name. No problem about this way. But I don't think it a
good
way
Could anybody help me with another solution?

Nov 16 '05 #2

P: n/a
Dear Stoitcho Goutsev,
Could I ask one more question?
Q: How could we limite a [stream] just read specific scale in the file
before passing stream to [Bitmap]? As you know, I try to save a "image file"
my file format, so if I pass the stream with no limited, the [Bitmap] could
not read image useful infomation.

For example my file format:

/////////////////////////////////////////
0-255 : Image_name
256-264 : Image_size
265..n : Image_file
/////////////////////////////////////////
(n = 265 + Image_size)

The Bitmap just should read the stream from 265 to n byte. How could we do
that?

Thanks

-------------------------------------------------------
"Stoitcho Goutsev (100) [C# MVP]" <10*@100.com> wrote in message
news:uI**************@TK2MSFTNGP11.phx.gbl...
Hi Dean,
Create a stream for each image and pass that stream to the Bitmap class'
constructor. I don't know your file format, but if you can't use the
original file stream you probably should create a memory stream then
transfer the image bytes form the file and pass that stream to the Bitmap's constructor.
"Dean L. Howen" <co*****@hotpop.com> wrote in message
news:eI*************@TK2MSFTNGP15.phx.gbl...
I create my own file format that could content many image files (jpg, ico, ...) . I can get the data of each image, and I want to display it on the
form. How can?
I've tried to create a file with the image data I want to show and open it with that file name. No problem about this way. But I don't think it a
good
way
Could anybody help me with another solution?


Nov 16 '05 #3

P: n/a
Hi Dean,

I haven't tested, but I'm pretty sure if you give the Bitmap construcotr a
stream with its pointer set to the 265th byte the bitmap will start reading
form there and will read as many bytes as it needs.
If you read your info part the pointer would be on the right position. If it
is not look at Stream.Seek method.
--
HTH
Stoitcho Goutsev (100) [C# MVP]
"Dean L. Howen" <co*****@hotpop.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Dear Stoitcho Goutsev,
Could I ask one more question?
Q: How could we limite a [stream] just read specific scale in the file
before passing stream to [Bitmap]? As you know, I try to save a "image
file"
my file format, so if I pass the stream with no limited, the [Bitmap]
could
not read image useful infomation.

For example my file format:

/////////////////////////////////////////
0-255 : Image_name
256-264 : Image_size
265..n : Image_file
/////////////////////////////////////////
(n = 265 + Image_size)

The Bitmap just should read the stream from 265 to n byte. How could we do
that?

Thanks

-------------------------------------------------------
"Stoitcho Goutsev (100) [C# MVP]" <10*@100.com> wrote in message
news:uI**************@TK2MSFTNGP11.phx.gbl...
Hi Dean,
Create a stream for each image and pass that stream to the Bitmap class'
constructor. I don't know your file format, but if you can't use the
original file stream you probably should create a memory stream then
transfer the image bytes form the file and pass that stream to the

Bitmap's
constructor.
"Dean L. Howen" <co*****@hotpop.com> wrote in message
news:eI*************@TK2MSFTNGP15.phx.gbl...
>I create my own file format that could content many image files (jpg, ico, > ...) . I can get the data of each image, and I want to display it on
> the
> form. How can?
> I've tried to create a file with the image data I want to show and open it > with that file name. No problem about this way. But I don't think it a
> good
> way
> Could anybody help me with another solution?
>
>



Nov 16 '05 #4

P: n/a
Dear Stoitcho Goutsev,
it seems not work.
I try to append the existing image file with some bytes, it still works, but
not if I add some byte in the header although I have seek to the right
position

---------------------------------------------------------

"Stoitcho Goutsev (100) [C# MVP]" <10*@100.com> wrote in message
news:#S*************@TK2MSFTNGP11.phx.gbl...
Hi Dean,

I haven't tested, but I'm pretty sure if you give the Bitmap construcotr a
stream with its pointer set to the 265th byte the bitmap will start reading form there and will read as many bytes as it needs.
If you read your info part the pointer would be on the right position. If it is not look at Stream.Seek method.
--
HTH
Stoitcho Goutsev (100) [C# MVP]
"Dean L. Howen" <co*****@hotpop.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Dear Stoitcho Goutsev,
Could I ask one more question?
Q: How could we limite a [stream] just read specific scale in the file
before passing stream to [Bitmap]? As you know, I try to save a "image
file"
my file format, so if I pass the stream with no limited, the [Bitmap]
could
not read image useful infomation.

For example my file format:

/////////////////////////////////////////
0-255 : Image_name
256-264 : Image_size
265..n : Image_file
/////////////////////////////////////////
(n = 265 + Image_size)

The Bitmap just should read the stream from 265 to n byte. How could we do that?

Thanks

-------------------------------------------------------
"Stoitcho Goutsev (100) [C# MVP]" <10*@100.com> wrote in message
news:uI**************@TK2MSFTNGP11.phx.gbl...
Hi Dean,
Create a stream for each image and pass that stream to the Bitmap class' constructor. I don't know your file format, but if you can't use the
original file stream you probably should create a memory stream then
transfer the image bytes form the file and pass that stream to the

Bitmap's
constructor.
"Dean L. Howen" <co*****@hotpop.com> wrote in message
news:eI*************@TK2MSFTNGP15.phx.gbl...
>I create my own file format that could content many image files (jpg,

ico,
> ...) . I can get the data of each image, and I want to display it on
> the
> form. How can?
> I've tried to create a file with the image data I want to show and open
it
> with that file name. No problem about this way. But I don't think it

a > good
> way
> Could anybody help me with another solution?
>
>



Nov 16 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.