Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Compact Framework / February 2008

Tip: Looking for answers? Try searching our database.

Large image

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Broeden - 29 Jan 2008 21:43 GMT
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
.
Simon Hart [MVP] - 30 Jan 2008 21:22 GMT
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.
Signature

Simon Hart
Visual Developer - Device Application Development MVP
http://simonrhart.blogspot.com

> Hi,
>
[quoted text clipped - 7 lines]
> /Broeden
> ..
Broeden - 30 Jan 2008 22:08 GMT
> 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
<ctacke/> - 30 Jan 2008 22:28 GMT
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

Signature

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

>> If size (depth) is a problem, maybe divide the image up and draw "tiles"
>> when required.
[quoted text clipped - 9 lines]
>
> /Broeden
Broeden - 31 Jan 2008 07:40 GMT
> 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
<ctacke/> - 31 Jan 2008 13:58 GMT
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.

Signature

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

>> The CF doesn't directly have any wrappers for this stuff,
>> but we'd done it in the SDF:
[quoted text clipped - 9 lines]
>
> /Broeden
Broeden - 02 Feb 2008 13:24 GMT
> 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
Hilton - 02 Feb 2008 16:42 GMT
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

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
<ctacke/> - 02 Feb 2008 16:50 GMT
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.

Signature

Chris Tacke, eMVP
Join the Embedded Developer Community
http://community.opennetcf.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
[quoted text clipped - 17 lines]
>
> /Broeden
Broeden - 02 Feb 2008 18:11 GMT
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
Hilton - 02 Feb 2008 21:51 GMT
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

> This is a little new to me.
>
[quoted text clipped - 4 lines]
>
> /Broeden
Broeden - 04 Feb 2008 19:09 GMT
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
<ctacke/> - 04 Feb 2008 19:27 GMT
You have to use Seek on the source stream and manually calculate the offsets
based on the image properties (bits per pixel, stride, etc).

Signature

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

> Thanks Hilton for your reply!
>
[quoted text clipped - 13 lines]
>
> /Broeden
Hilton - 04 Feb 2008 20:03 GMT
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

> You have to use Seek on the source stream and manually calculate the
> offsets based on the image properties (bits per pixel, stride, etc).
[quoted text clipped - 16 lines]
>>
>> /Broeden
Hilton - 02 Feb 2008 21:49 GMT
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

>> 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
[quoted text clipped - 17 lines]
>>
>> /Broeden

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.