Hi,

I have a map in the format of 3000 * 3000 pixel bmp-file. This is of
course to big to load into a bitmap.
Does anyone have any ideas how to handle this image to be able to pan
the map in the PDA. Do I have to cut the image into smaller pieces or
is it somehow possible to read small parts of the image depending on
which part of the map to be shown while panning?

/Broeden
.

RE: Large image by srhartone

srhartone
Wed Jan 30 15:22:01 CST 2008

The easiest way would be to use a PictureBox control and set the scroll bars
which will allow you to scroll the image. This depends on the size of the
image (colour depth) as to whether your device will render it before it runs
out of memory.

If size (depth) is a problem, maybe divide the image up and draw "tiles"
when required.
--
Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com


"Broeden" wrote:

> Hi,
>
> I have a map in the format of 3000 * 3000 pixel bmp-file. This is of
> course to big to load into a bitmap.
> Does anyone have any ideas how to handle this image to be able to pan
> the map in the PDA. Do I have to cut the image into smaller pieces or
> is it somehow possible to read small parts of the image depending on
> which part of the map to be shown while panning?
>
> /Broeden
> ..
>

Re: Large image by Broeden

Broeden
Wed Jan 30 16:08:07 CST 2008

On 30 Jan, 22:22, Simon Hart [MVP] <srhart...@yahoo.com> wrote:

> If size (depth) is a problem, maybe divide the image up and draw "tiles"
> when required.
>

Yes, the size is the problem. I have thought about dividing the image
into smaller images. But if it's possible I want to read parts of
image directly from the imagefile or load the whole image into a byte
array and than create selected parts of the image when needed. Is this
possible?

Is it possible to read parts of the image (bmp) via some sort of
stream?

/Broeden

Re: Large image by ctacke/>

ctacke/>
Wed Jan 30 16:28:23 CST 2008

To do it directly is difficult becasue you have to look at the stride of the
data and pull only parts of each scan line, essentially pulling just the
data you want and assembling a new bitmap. Doable, but not fun. It's a lot
easier to use an existing function like that which the native Imaging
library provides. The CF doesn't directly have any wrappers for this stuff,
but we'd done it in the SDF:

http://blog.opennetcf.org/afeinman/CategoryView,category,SDF%202.0.aspx


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com


"Broeden" <hihansson@hotmail.com> wrote in message
news:9137d4b3-1d24-4fca-b508-0cdee6a4bfeb@i29g2000prf.googlegroups.com...
> On 30 Jan, 22:22, Simon Hart [MVP] <srhart...@yahoo.com> wrote:
>
>> If size (depth) is a problem, maybe divide the image up and draw "tiles"
>> when required.
>>
>
> Yes, the size is the problem. I have thought about dividing the image
> into smaller images. But if it's possible I want to read parts of
> image directly from the imagefile or load the whole image into a byte
> array and than create selected parts of the image when needed. Is this
> possible?
>
> Is it possible to read parts of the image (bmp) via some sort of
> stream?
>
> /Broeden



Re: Large image by Broeden

Broeden
Thu Jan 31 01:40:48 CST 2008

On 30 Jan, 23:28, "<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote:
> The CF doesn't directly have any wrappers for this stuff,
> but we'd done it in the SDF:
>
> http://blog.opennetcf.org/afeinman/CategoryView,category,SDF%202.0.aspx
>

Thanks for your information!

I'm new to OpenNETCF. What do I have to think about before using the
SDF in my product?

I'm using CF2.0 and VS2005.

/Broeden

Re: Large image by ctacke/>

ctacke/>
Thu Jan 31 07:58:19 CST 2008

Nothing. The community edition is free, so just download, install, add a
reference and use. If you want Studio integration with toolbox support,
help, templates and full source code then you can buy the SDF Extensions for
Studio for a nominal fee.


--

Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com




"Broeden" <hihansson@hotmail.com> wrote in message
news:214ad1e1-d499-47ed-9897-9e8cfa487d4a@f47g2000hsd.googlegroups.com...
> On 30 Jan, 23:28, "<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote:
>> The CF doesn't directly have any wrappers for this stuff,
>> but we'd done it in the SDF:
>>
>> http://blog.opennetcf.org/afeinman/CategoryView,category,SDF%202.0.aspx
>>
>
> Thanks for your information!
>
> I'm new to OpenNETCF. What do I have to think about before using the
> SDF in my product?
>
> I'm using CF2.0 and VS2005.
>
> /Broeden



Re: Large image by Broeden

Broeden
Sat Feb 02 07:24:21 CST 2008

On 31 Jan, 14:58, "<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote:
> Nothing. =A0The community edition is free, so just download, install, add =
a
> reference and use. =A0If you want Studio integration with toolbox support,=

> help, templates and full source code then you can buy the SDF Extensions f=
or
> Studio for a nominal fee.

Thanks again!

I have install the SDF and tested the samples. I have found out how to
load parts of the image to get a thumbnail of the image.
But is it possible to load for instance the upper left 1000*1000
pixels of a large image?

/Broeden

Re: Large image by Hilton

Hilton
Sat Feb 02 10:42:57 CST 2008

If I recall, you're working with BMP images. If that is the case, you can
write a relatively simply method to read and decode the BMP into a Bitmap
object. use SetPixel while testnig and LockBits to optimize.

Hilton


"Broeden" <hihansson@hotmail.com> wrote in message
news:d445e050-11a3-4146-b328-c7e5286d81d6@s12g2000prg.googlegroups.com...
On 31 Jan, 14:58, "<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote:
> Nothing. The community edition is free, so just download, install, add a
> reference and use. If you want Studio integration with toolbox support,
> help, templates and full source code then you can buy the SDF Extensions
> for
> Studio for a nominal fee.

Thanks again!

I have install the SDF and tested the samples. I have found out how to
load parts of the image to get a thumbnail of the image.
But is it possible to load for instance the upper left 1000*1000
pixels of a large image?

/Broeden



Re: Large image by ctacke/>

ctacke/>
Sat Feb 02 10:50:55 CST 2008

The problem there is just trying to load a 3000x3000 bitmap is very likely
to run the device out of memory long before it's fully in memory. SetPixel
will be painfully slow if attempting to copy the data. It's probably better
to just lock the destination bitmap and use copy methods to pull from a
stream and write it into the scan0 ptr at an offset.


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com





"Hilton" <nospam@nospam.com> wrote in message
news:l41pj.10164$hI1.6408@nlpi061.nbdc.sbc.com...
> If I recall, you're working with BMP images. If that is the case, you can
> write a relatively simply method to read and decode the BMP into a Bitmap
> object. use SetPixel while testnig and LockBits to optimize.
>
> Hilton
>
>
> "Broeden" <hihansson@hotmail.com> wrote in message
> news:d445e050-11a3-4146-b328-c7e5286d81d6@s12g2000prg.googlegroups.com...
> On 31 Jan, 14:58, "<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote:
>> Nothing. The community edition is free, so just download, install, add a
>> reference and use. If you want Studio integration with toolbox support,
>> help, templates and full source code then you can buy the SDF Extensions
>> for
>> Studio for a nominal fee.
>
> Thanks again!
>
> I have install the SDF and tested the samples. I have found out how to
> load parts of the image to get a thumbnail of the image.
> But is it possible to load for instance the upper left 1000*1000
> pixels of a large image?
>
> /Broeden
>



Re: Large image by Broeden

Broeden
Sat Feb 02 12:11:16 CST 2008

This is a little new to me.

Can you be a bit more specific? For instance, to simplify. How do I
read half of a 2000 *2000 pixel bmp (2000 * 1000) into an bitmap
object?
Without first loading the whole image into the memory of course.

/Broeden

Re: Large image by Hilton

Hilton
Sat Feb 02 15:49:59 CST 2008

Chris,
> The problem there is just trying to load a 3000x3000 bitmap is very likely
> to run the device out of memory long before it's fully in memory.

Correct, that's why I said that he should write a "read and decode" method,
essentially the equivalent of "new Bitmap (filename, x, y, cx, cy)".

> SetPixel will be painfully slow if attempting to copy the data. It's
> probably better to just lock the destination bitmap and use copy methods
> to pull from a stream and write it into the scan0 ptr at an offset.

Right, that's why I suggested to use SetPixel while testing (i.e. just get
it working), then use LockBits (i.e. scan0) to optimize, unless using scan0
initially would be best although i doubt it given the number of BMP formats,
pixel depths, etc.

Hilton


> "Hilton" <nospam@nospam.com> wrote in message
> news:l41pj.10164$hI1.6408@nlpi061.nbdc.sbc.com...
>> If I recall, you're working with BMP images. If that is the case, you
>> can write a relatively simply method to read and decode the BMP into a
>> Bitmap object. use SetPixel while testnig and LockBits to optimize.
>>
>> Hilton
>>
>>
>> "Broeden" <hihansson@hotmail.com> wrote in message
>> news:d445e050-11a3-4146-b328-c7e5286d81d6@s12g2000prg.googlegroups.com...
>> On 31 Jan, 14:58, "<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote:
>>> Nothing. The community edition is free, so just download, install, add a
>>> reference and use. If you want Studio integration with toolbox support,
>>> help, templates and full source code then you can buy the SDF Extensions
>>> for
>>> Studio for a nominal fee.
>>
>> Thanks again!
>>
>> I have install the SDF and tested the samples. I have found out how to
>> load parts of the image to get a thumbnail of the image.
>> But is it possible to load for instance the upper left 1000*1000
>> pixels of a large image?
>>
>> /Broeden
>>
>
>



Re: Large image by Hilton

Hilton
Sat Feb 02 15:52:00 CST 2008

Well, you'll have to browse the web or buy a book and become familiar with
the BMP format - it's a pretty brain dead format - hence its bad compression
and then figure out what parts to read and 'decode' into bits, bytes, and
pixels. The bottom line it that you are going to have to write the image
reading code or buy it if anyone has something. If I have some time, I
might be able to write it for you, but not before the end of April.

Hilton


"Broeden" <hihansson@hotmail.com> wrote in message
news:d24c8e32-dca9-49e8-9996-d4015bb154e4@s12g2000prg.googlegroups.com...
> This is a little new to me.
>
> Can you be a bit more specific? For instance, to simplify. How do I
> read half of a 2000 *2000 pixel bmp (2000 * 1000) into an bitmap
> object?
> Without first loading the whole image into the memory of course.
>
> /Broeden



Re: Large image by Broeden

Broeden
Mon Feb 04 13:09:54 CST 2008

Thanks Hilton for your reply!

I found some articles on how to manipulate bitmaps on the Net to start
with.

What I'm now looking for is an example of how to select parts of the
stream.

For instance how could SkipEverySecondPixel be implemented?

Stream stream = new Stream("test.bmp");
Stream newStream = SkipEverySecondPixel(Stream);
bmp = new Bitmap(NewStream );
stream.Close();
newStream.Close();

/Broeden


Re: Large image by ctacke/>

ctacke/>
Mon Feb 04 13:27:20 CST 2008

You have to use Seek on the source stream and manually calculate the offsets
based on the image properties (bits per pixel, stride, etc).


--

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.com



"Broeden" <hihansson@hotmail.com> wrote in message
news:27e398a7-321b-4602-ab78-b2db45baa8ba@s13g2000prd.googlegroups.com...
> Thanks Hilton for your reply!
>
> I found some articles on how to manipulate bitmaps on the Net to start
> with.
>
> What I'm now looking for is an example of how to select parts of the
> stream.
>
> For instance how could SkipEverySecondPixel be implemented?
>
> Stream stream = new Stream("test.bmp");
> Stream newStream = SkipEverySecondPixel(Stream);
> bmp = new Bitmap(NewStream );
> stream.Close();
> newStream.Close();
>
> /Broeden
>



Re: Large image by Hilton

Hilton
Mon Feb 04 14:03:37 CST 2008

If the BMP is compressed, you need to handle that too. Do this using
streams; i.e. open the BMPStream using another stream (or filename). This
BMPStream would have calls like "Color NextPixel", SkipPixels (int n), and
"MoveToNextRow" etc; i.e. the code reading this stream should not care about
how the BMP is compressed. If it made sense, you could add SkipRow(), you
don't need SkipPixel since you could just call NextPixel and ignore what it
returns. However, getting back to what you originally asked, you need to
think about the new Bitmap (filename, x, y, cx, cy) call. If you can solve
that, you're pretty much done.

Hope that makes sense.

Hilton




"<ctacke/>" <ctacke[at]opennetcf[dot]com> wrote in message
news:uEC38P2ZIHA.748@TK2MSFTNGP04.phx.gbl...
> You have to use Seek on the source stream and manually calculate the
> offsets based on the image properties (bits per pixel, stride, etc).
>
>
> --
>
> Chris Tacke, eMVP
> Join the Embedded Developer Community
> http://community.opennetcf.com
>
>
>
> "Broeden" <hihansson@hotmail.com> wrote in message
> news:27e398a7-321b-4602-ab78-b2db45baa8ba@s13g2000prd.googlegroups.com...
>> Thanks Hilton for your reply!
>>
>> I found some articles on how to manipulate bitmaps on the Net to start
>> with.
>>
>> What I'm now looking for is an example of how to select parts of the
>> stream.
>>
>> For instance how could SkipEverySecondPixel be implemented?
>>
>> Stream stream = new Stream("test.bmp");
>> Stream newStream = SkipEverySecondPixel(Stream);
>> bmp = new Bitmap(NewStream );
>> stream.Close();
>> newStream.Close();
>>
>> /Broeden
>>
>
>