 |
|
|
|
| Author |
Message |
Broeden
Joined: 08 Aug 2007 Posts: 13
|
Posted: Tue Jan 29, 2008 6:43 pm Post subject: Large image |
|
|
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
..
Archived from group: microsoft>public>dotnet>framework>compactframework |
|
| Back to top |
|
 |
Simon Hart [MVP]
Joined: 03 Oct 2007 Posts: 95
|
Posted: Wed Jan 30, 2008 6:22 pm Post subject: RE: Large image |
|
|
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
> ..
> |
|
| Back to top |
|
 |
Broeden
Joined: 08 Aug 2007 Posts: 13
|
Posted: Wed Jan 30, 2008 7:08 pm Post subject: Re: Large image |
|
|
On 30 Jan, 22:22, Simon Hart [MVP] 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 |
|
| Back to top |
|
 |
user
Joined: 08 Aug 2007 Posts: 286
|
Posted: Wed Jan 30, 2008 9:28 pm Post subject: Re: Large image |
|
|
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" wrote in message @i29g2000prf.googlegroups.com...
> On 30 Jan, 22:22, Simon Hart [MVP] 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 |
|
| Back to top |
|
 |
Broeden
Joined: 08 Aug 2007 Posts: 13
|
Posted: Thu Jan 31, 2008 4:40 am Post subject: Re: Large image |
|
|
On 30 Jan, 23:28, "" 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 |
|
| Back to top |
|
 |
user
Joined: 08 Aug 2007 Posts: 286
|
Posted: Thu Jan 31, 2008 12:58 pm Post subject: Re: Large image |
|
|
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" wrote in message @f47g2000hsd.googlegroups.com...
> On 30 Jan, 23:28, "" 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 |
|
| Back to top |
|
 |
Broeden
Joined: 08 Aug 2007 Posts: 13
|
Posted: Sat Feb 02, 2008 10:24 am Post subject: Re: Large image |
|
|
On 31 Jan, 14:58, "" 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 |
|
| Back to top |
|
 |
Hilton
Joined: 08 Aug 2007 Posts: 56
|
Posted: Sat Feb 02, 2008 1:42 pm Post subject: Re: Large image |
|
|
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" wrote in message @s12g2000prg.googlegroups.com...
On 31 Jan, 14:58, "" 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 |
|
| Back to top |
|
 |
user
Joined: 08 Aug 2007 Posts: 286
|
Posted: Sat Feb 02, 2008 3:50 pm Post subject: Re: Large image |
|
|
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" wrote in message $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" wrote in message
> @s12g2000prg.googlegroups.com...
> On 31 Jan, 14:58, "" 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
> |
|
| Back to top |
|
 |
Broeden
Joined: 08 Aug 2007 Posts: 13
|
Posted: Sat Feb 02, 2008 3:11 pm Post subject: Re: Large image |
|
|
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 |
|
| Back to top |
|
 |
Hilton
Joined: 08 Aug 2007 Posts: 56
|
Posted: Sat Feb 02, 2008 6:49 pm Post subject: Re: Large image |
|
|
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" wrote in message
> $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" wrote in message
>> @s12g2000prg.googlegroups.com...
>> On 31 Jan, 14:58, "" 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
>>
>
> |
|
| Back to top |
|
 |
Hilton
Joined: 08 Aug 2007 Posts: 56
|
Posted: Sat Feb 02, 2008 6:51 pm Post subject: Re: Large image |
|
|
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" wrote in message @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 |
|
| Back to top |
|
 |
Broeden
Joined: 08 Aug 2007 Posts: 13
|
Posted: Mon Feb 04, 2008 4:09 pm Post subject: Re: Large image |
|
|
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 |
|
| Back to top |
|
 |
user
Joined: 08 Aug 2007 Posts: 286
|
Posted: Mon Feb 04, 2008 6:27 pm Post subject: Re: Large image |
|
|
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" wrote in message @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
> |
|
| Back to top |
|
 |
Hilton
Joined: 08 Aug 2007 Posts: 56
|
Posted: Mon Feb 04, 2008 5:03 pm Post subject: Re: Large image |
|
|
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
"" wrote in message @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" wrote in message
> @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
>>
>
>
|
|
| Back to top |
|
 |
|
|
| Related Topics: | How to rotate image? How to rotate image in .net cf? I want to get the original image's scan line, than create a new bitmap and get its scan line and write to it directly. My question is how to get the scan line? And I also wounder what is The return of it
How to put a image to the menu item? The MenuItem class in CF dose not support OwnerDraw and Handle property. I can not get the form's native handle also. I have no idea of putting a image to the menu item other than use OwerDraw. Anyone can give me some comment? Thanks! Dolphin White
Resizing a bitmap image that works? Hi all, Does anyone know how to resize a bmp image on the compact Framework? I have spent ages trying and looking for an answer. Any help will be appriciated. I have some code I've been trying to to work:- Bitmap b1 = new Bitmap newI
Call Image.Dispose when clearing an Image List? Hi, I have a listview which is set to view items in a small icon view. It's set up to get the images from an image list. When I populate the listview, I clear the image list and add new images for each item. This seems to work fine, but what I was wonderi
Large files using WS? Hi Anybody any whether it is good practice sending large files (csv-file, 20-30MB) to a central Server by using a WebService (most likely called myfile)'). An alternative would be using DIME? Or another would be using nati |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|