Download the free trial version
Basic4android Video
Features
Tutorials and manuals
Showcase
Screenshots

Go Back   Android Development Forum - Basic4android > Basic4ppc (Windows Mobile) > Code Samples & Tips > Additional Libraries
Documentation Wiki Register Members List B4P Search Today's Posts Mark Forums Read

Additional Libraries Users contributed libraries.
This sub-forum is only available to licensed users.

Jpeg library - display large images on the device

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-26-2009, 11:28 AM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default Jpeg library - display large images on the device

Cameras on devices are getting higher in resolution but displaying those images in the Compact Framework is not possible owing to memory limitations on the device. Native code applications that can display such images do so by only decoding partial images using very low level techniques. I have licensed the source code of a native code library that does such manipulation and agreed terms that Basic4ppc users may, without further licensing, use the resulting library and it's .NET wrapper for personal use. Full terms of the license are in the help.

This first iteration of the library can display and save reduced size versions of complete large images without running into memory problems. I will add decoding of partial areas of large images once I am a bit more familiar with the functionality available.

The library requires .NET 2.0. Help and a very small demo are included but you will need your own large image to try it. I am afraid that source code for merging the .NET wrapper part of the library is not available.

EDIT :- Version 1.1 posted. See post #6 for details.
Attached Files
File Type: zip Jpeg1.1.zip (66.9 KB, 200 views)
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.

Last edited by agraham : 11-29-2009 at 04:44 PM.
Reply With Quote
  #2 (permalink)  
Old 11-26-2009, 04:25 PM
Basic4ppc Veteran
 
Join Date: Apr 2007
Location: Netherlands
Posts: 216
Default

Hi Agraham,

Fantastic. I have done a quick test on my device and it works. I will now implement it in the program where large images gave problems. I will inform you.

Harry
Reply With Quote
  #3 (permalink)  
Old 11-27-2009, 02:15 PM
Erel's Avatar
Administrator
 
Join Date: Apr 2007
Posts: 13,162
Awards Showcase
Basic4ppc Founder 
Total Awards: 1
Default

Thank you once again Andy for another useful library.
__________________
Basic4android documentation
Reply With Quote
  #4 (permalink)  
Old 11-28-2009, 03:10 PM
Basic4ppc Veteran
 
Join Date: Apr 2007
Location: Netherlands
Posts: 216
Default

Hi Agraham,

Also in my program that new library works very well. Still I have two questions, just for my understanding:

1) The Load method does not reduce the bitmap, does it? I wonder whether the Load method really will prevent OutOfMemory. In my understanding the size of the JPEG file is not the reason for this message , but the size of the decoded bitmap. The code will try to allocate a block of memory with a size of roughly image width * image height* 3 or 4 bytes. Am I right?

2) The LoadThumbnail method does not read the thumbnail in the JPEG file, but makes a kind of thumbnail. At least if I specify a small width and height. Am I right?

The quality of the image is such good that it can hardly be a blown up version of the thumbnail in the JPEG file, which is not always present anyhow, I believe.

Harry
Reply With Quote
  #5 (permalink)  
Old 11-28-2009, 05:28 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Quote:
Originally Posted by HARRY View Post
1) The Load method does not reduce the bitmap, does it?
No, it just loads it like you say so it will cause problems on large images.

Quote:
2) The LoadThumbnail method does not read the thumbnail in the JPEG file, but makes a kind of thumbnail.
Yes, I tried to explain in the help - I'll try to make it clearer for the next release. The file is read in one scan line of the image at a time. The scan line is compressed to the width you specify, for high quality it is interpolated, for low quality bytes are discarded. For high quality as many scan lines as are needed to form one scan line of the thumbnail are interpolated vertically, for low quality scanlines that are not needed are discarded.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
  #6 (permalink)  
Old 11-29-2009, 04:48 PM
agraham's Avatar
Basic4ppc Expert
 
Join Date: Jul 2007
Location: Cheshire, UK
Posts: 5,953
Awards Showcase
Innovator medal Beta Tester Forum Contributer 
Total Awards: 3
Default

Version 1.1 now posted.

Added GetSize to return the width and height of an image without having to load it and possibly run into memory problems.

Added LoadArea which will load a part of a large image at full size.

Added LoadAreaThumbnail which will load part of a large image resized to fit into a specifed area.

Hopefully, together with BitmapEx from ImageLibEx, this should be all you need to manage and display large images.
__________________
Sorry, but I don't answer questions by PM or email.
Please post your queries in the forum.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Desktop/Device Display Differences dlfallen Bug Reports 4 03-14-2009 06:31 PM
Display images in table column chow Questions (Windows Mobile) 1 04-23-2008 12:50 PM
Display large text file JamesC Questions (Windows Mobile) 3 03-08-2008 03:45 AM
db2000 - JPEG Exif maXim Italian Forum 5 03-07-2008 07:03 PM
Is it possible to open a JPEG and resize? tigme Questions (Windows Mobile) 5 02-19-2008 09:19 PM


All times are GMT. The time now is 05:05 AM.


Powered by vBulletin® Version 3.6.12
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0