|
|
Comments and Discussions
|
|
 |

|
I have created images that work great w/ Silverlight 3, however, when using Silverlight 4 they do not work.. i can see portions of the image, but not in detail . :(
|
|
|
|

|
Hi there - the article seems amazing. I am just having trouble using it. I cant run the runtime one. When it tries to open in my web browser it shows a blank screen. Is this due to a deepzoomer change or am I supposed to change something. Thanks A LOT for this. We are looking into document to deep zoom functionality at work.
Cheers
marthinus
I am free within. I know that all my wrong doings (debt) towards God have been paid for in full by Jesus Christ. Heaven awaits me!!
|
|
|
|

|
Just wondering if you are going to port this to the final version of Silverlight?
|
|
|
|

|
Good that you remind me, that should be done. Unfortunately, I have even less spare time available than I anticipated, so it might take several weeks before I get to it (faithful readers may have noticed that I still did not get around to make a codeplex version either ).
Do you know if they changed the deepzoom image model at all? If not, it would be enough to replace the web page and xap runtime with versions generated by the release version of Deepzoom Composer. My tool is itself written in plain dotnet code and does not depend on Silverlight in any way, you can even compile and run it in dotnet 1.1.
|
|
|
|

|
Hello,
excelent work!
i have a problem! i have most recent version of Silverlight installed, so i can not run correctly the application
Is is normal?
best regards,
MD
|
|
|
|

|
Hi there. This is like a light at the end of a very long tunnel for me.
I've been searching for a way to get a very high res image 'DeepZoomed' without any loss in quality - something that DeepZoom doesnt handle very well in it's native format.
Is there a file size limit when using DecosDeepZoom? I keep getting the error 'DeepZoom image generation failed' on large images - it works fine on smaller ones.
Any ideas?
Thanks
Paolo
p.s here's a few examples of what I mean -
http://kite.seriouslyinternet.com/pixel_original.png
http://kite.seriouslyinternet.com/pixel_deepzoom.png
modified on Tuesday, July 8, 2008 1:40 PM
|
|
|
|

|
I think the blurring is something inherent to the DeepZoom viewer. Actually I do not see much blurring when I convert your pixel_original.png image and look at it at approximatel 100% scale in the deepzoom viewer, but perhaps it already is an enlargement? To see if it is the viewer or the convertor, investigate the highest scale converted tiles you fond below %TEMP%\DecosDeepZoom\GeneratedImages\dzc_output_images on your hard disk. If they are also blurred, increase the jpeg quality in the conversion (now 90%).
The loss of color -if you use my code- is due to the less quality color model I use for speed. In the article I explain how to change the code from 15 bits to 24 bits per pixel, then you should not have any loss of color depth anymore.
Why your large images fail, I cannot say unless you provide me with a sample. Perhaps you can point to an image that is already online which fails, or upload a zipped image. There are several file sharing systems that you could use to provide an online copy of a large file, e.g., rapidshare.com or megaupload.com.
Hope this helps,
Berend
modified on Tuesday, July 8, 2008 5:45 PM
|
|
|
|

|
Hi Berend, thanks for the reply. My image is only 13Mb - the Mars demo one works ok for me...
Here's the original - it's a PNG at the moment - http://kite.seriouslyinternet.com/PixelCity.png
If you have a look at this in Photoshop or similar, you can zoom up to 3000% with no loss of quality. This is what I'm looking for )
I'm just not sure it's possible at the current time?
Thanks for help
Paolo
p.s. Just tried it with a smaller section of the original PNG image.
JPG set to 100 colour at 24bppRgb and other settings set to 'HighQuality'
This looks pretty damn good to me - if only I could do the whole image...
Thanks for your help - this would be impossible without your ideas.
p.p.s Is there a setting for maximum dimensions or similar?
modified on Wednesday, July 9, 2008 9:34 AM
|
|
|
|

|
Hello,
I have looked in to your problem. The cause of the problem was an internal error ("out of memory") in the clone constructor of System.Drawing.Bitmap, that I use in this line in my PageBitmap constructor:
m_bm = new Bitmap(bmPage);
It seems that it internally uses DrawImage and DrawImage raises the error.
The reason I used this particular constructor is to split multipage tiff images in single page bitmaps. Actually, that is not required in your situation because a png is always a single page image. This allowed me to fix the problem by simply using a reference instead of a clone if the image is single page, it also makes startup code slightly faster:
if (iPageCount > 1)
{
// Clone the specified page of the source image
bmPage.SelectActiveFrame(FrameDimension.Page, iPage);
m_bm = new Bitmap(bmPage);
m_bm.SetResolution(bmPage.HorizontalResolution, bmPage.VerticalResolution);
}
else
{
// since we have only one page, just reference the bitmap (faster)
m_bm = bmPage;
}
While I was at it, I made two more small improvements:
- Use png tiles if all source images are png (before png was used only for black and white images).
- Expose JpegQuality and PixelFormat (bits per pixel) and allow to set them from the UI.
Now your image works, but it still blurs when you zoom in. It must be the viewer, because when I look at the png tiles in Photoshop, they are fine. Note that JpegQuality is now ignored for png input and that "high quality" scaling does not affect the problem either: the maximum size tiles are actually not scaled, that is only used when creating smaller tiles.
I have uploaded new sources and runtime, but the helpfile is not regenerated (yet).
|
|
|
|

|
Well I'm glad someone knows what they're doing
I'll give it another go but I think you are correct about the viewer blurring it.
Thanks for all your help
|
|
|
|

|
If you compare the enlarged image in the DeepZoom viewer with one tile zoomed in by the Windows Picture and Fax Viewer, you'll notice that the same algorithm is used:
Comparison of zoomed in DeepZoom image and original png tile[^]
The linked screenshot shows a tiny part of the DeepZoom image from your sample, one tile zoomed in Windows Picture and Fax Viewer and the same tile zoomed in with Windows Paint. Notice that Paint shows sharp blocks for the pixels (nearest neighbour interpolation) but both DeepZoom viewer and Picture and fax viewer show them blurred (some kind of bicubic interpolation). The intention is to produce an anti-aliased effect, which -according to Microsoft- is supposed to improve readability of zoomed text (they explain about it here for IE7).
|
|
|
|

|
That does explain a lot. It's maybe a feature the developers might want to look at? They should include an option for this...
p.s. I've posted a link to this discussion on the DeepZoom forum - hope you don't mind - FORUM
Also, it seems obvious in retrospect - that's why images never pixelate when zooming in with DeepZoom - DOH!
modified on Thursday, July 10, 2008 8:05 AM
|
|
|
|

|
Hey Berend,
Awesome article! I appreciate all the work you've shared, and if you codeplex it I would love to contribute.
I've modified your source to import multiple images and PDFs (treating them the same way you're treating multi-page tiffs). To enable this I did amemory optimization such that each PageBitmap stored in the alBitmaps array does not keep the Bitmap in memory and only retrieves it when needed.
This works great for collections of moderate size (ie 100 images), but for very large collections (say > 1000 images) I get two possible exceptions, both during the CreateCollectionThumbnails step. First, the using (Bitmap bmThumbnails = new Bitmap(iMortonWidth * TILESIZE, iMortonHeight * TILESIZE, PixelFormat.Format16bppRgb555)) line gives an invalid argument exception sometimes for large sets unless I turn down the TILESIZE (from 512 to 256 or 256 to 128). If this step passes, then when CreateTiles is called (with iLevel = 0), the using (EditableBitmap bmScaled = new EditableBitmap(bm, PixelFormat.Format16bppRgb555, iWidth, iHeight, bSmoothScaling)) throws an OutOfMemoryException, caused by the EditableBitmap constructor when it calls g.DrawImage(source, 0, 0, newWidth, newHeight);
The image it's trying to draw is quite large (i.e. 16384x16384). But I have 3gb of RAM and this image size isn't unheard of.
This exception is causing quite a bit of pain for me as it takes quite a while to generate all the images of a large collection and then it wonks out at the last step. Is there another way to produce the collection thumbnails without having to iterate through all the images and creating a mega-tile?
This guy here has managed to generate 10,000 images http://sharepoint.styletronix.net/blog/default.aspx[^] by dynamically adding to the set (though he is using the .exe DZ tools I believe). With your code it seems you need to iterate through all the PageBitmaps in the alBitmaps to generate the collection thumbnails, which isn't scalable for large collections. Do you any guesses to how he might have achieved this?
Thanks so much for any insight! (I'm trying to get this up for a demo and the deadline is soon!)
|
|
|
|

|
Hello,
I want to work on creating very large deepzoom collections this weekend and codeplex a variant of DecosDeepZoom that does that. Not retaining images in memory is an obvious optimization, I'll certainly put that in. The algorithm for creating image tile sets is suitable for sequential processing, I only need to keep in memory the image dimensions (to allow scene building) and the level index for the highest level where a single tile thumbnail could be created.
The size of the top level thumbnail page is indeed the next limit that presents itself. You are right that a dimension of 16k is not overly large and it is disappointing that a limit is hit so soon. If you look through the previous posts in this thread, you'll find that the poster "deepzoom" had a similar problem. He wanted to feed a png image of 10,000 x 10,107 pixels to DecosDeepZoom and it failed on "out of memory" (the image is only 13 MB, no way the pc should run out of memory). What I saw was that DrawImage fails when it tries to draw on a surface of that size and that function throws the "out of memory" exception, same as in your case. In my workaround, I simply avoided the issue by not using DrawImage in the PageBitmap constructor, other than that everything worked fine.
What I plan to do for the thumbnail tiles is no longer drawing a full thumbnails page, but instead starting by single thumbnail images at top level and on each stage combining 4 adjoining thumbnails in one tile. Of course that makes the math slightly more complex, but then there will be no more scaling problems because the in memory image will never be bigger than the tile size.
|
|
|
|

|
I have rewitten CreateCollectionThumbnails so that it does not need a large bitmap anymore. Could you please retry your large collection with the new code? It suffices to replace CreateCollectionThumbnails in your version, there was no other change to the source code since July 9.
|
|
|
|

|
Hi Berend,
It works now. No more OutOfMemoryExceptions. I passed about 2800 images through and it worked like a charm (had to leave it on all night to generate!) Great job!
However, I noticed that the dzc_output_images folder only has a "0" subdirectory and all the thumbnails in it are black. So the collection thumbnails aren't being used. This means when the viewport first loads (I have it zoomed out to view all images)all the thumbnails are black and take a very long time to load the tiles. Otherwise they are all black. Also, the iFullPageLevel passed into CreateCollectionThumbnails is 0 ... is this expected? I'm going to do some more investigation when I have time but I have a feeling it's to do with if (File.Exists(sThumbnailPath)) failing due to the directory not being there.
I'm using only pngs since I'm dealing with documents, and I chose high-quality scaling options, so the tiles also take longer to load as well (but that's something I can adjust).
|
|
|
|

|
No, the iFullPageLevel should definitely not be 0. Perhaps that is due to one image that failed to generate, the value is the minimum of the values for each picture. iFullPageLevel is the highest level where each picture fits on one single tile.
Since tiles are 256 pixels, I would expect iFullPageLevel to be 8 (2^8 = 256). I will investigate if I can hard-code 8 instead of calculating it, but there must be something else going wrong for it to become 0. In your code, you might just try to set it to 8 to see if the function then continues as expected.
By the way, unfortunately my weekend project for codeplex is delayed, I could not work on it this weekend due to unexpected circumstances.
|
|
|
|

|
Berend,
I will give your suggestion a shot. I think there may have been some improperly imaged pdfs in my collection. I will let you know the results.
Don't worry... take the weekend off, you deserve it . Let me know if I can help in any way.
Cheers,
Tian
|
|
|
|

|
Hi Berend,
I forgot to give you an update...I gave your suggestion a shot and tried another collection of PDFs and it worked fine, so I think it was due to faulty imaging of the source files. Again, great work, and I'll try to post any future enhancements.
Cheers,
Tian
|
|
|
|

|
I haven't tried your app but this sounds nice and fulfills a hole in the use of this technology that I hope to do some day. I have created a deepzoom set of images and multiscaleimage etc a while back but the purpose I'd use it for would need the creation of the tiles by the composer to be more automated/easier.
This is a step in that direction, thanks. When I get some play time I'll look into it more.
|
|
|
|

|
Thanks, my goal is also to accomplish automated generation of DeepZoom images, I designed it with that in mind. The user interface part is just for demo purposes.
|
|
|
|

|
That is sweet. I've been wondering if it was possible to do this on ones own. I especially like that you have figured out the thumb-nail issue - I gave up before I got to that.
I've done something similar for conferences in my field: http://d0.phys.washington.edu/~gwatts/conference.html[^], but I use the tool that comes with the Composer tool. The code that does this is up on codeplex (DeepTalks).
Have you stressed the Silverlight display tool? Tried doing something like having 1000's of pages up on the display at once? What is the largest number and did you notice any performance difference?
-Gordon.
|
|
|
|

|
Thanks for your reply Gordon. No, I have not stressed the Silverlight display tool, I have only looked at server load for thumbnail generation (both space and CPU time requirements), as that is what is important for the decision makers in my company to decide if deepzoom may be an option to base a scan viewer on in a future version of our DMS.
It is an interesting point though. Usually, for commercial customers, the average scan only has a few pages, but non-profit organizations (either government or academic) are likely to have much larger documents (e.g., I know a customer who keeps all welfare files in our DMS and those files tend to grow to many hundreds of pages for the more "interesting" clients).
Points to consider for large collections:
- It is possible to reformat the scene graph for a collection at the client side. After publishing my stuff, I found a good example here: Project Silverlight[^], look for their deepzoom sample if it is no longer on the front page. If there is a performance problem, it might be possible to limit the scene to a maximum number of pages and use browse controls to navigate between the blocks of pages. E.g., it you limit to 500 pages, you could browse per block of 500.
- The linear scene organization that I used in my sample is inappropriate for a large set. You will get a rectangle with a very small aspect ratio quickly. Using a rectange with sides of about sqrt(n) to display n pages would be best. To fix that in my sample code, the code that determines pbm.PhysTop and pbm.PhysLeft would need to be rewritten (currently in GenerateFromScanFile and CreateSceneAndMetadataXml).
- The function GetMortonDimensions that I use to determine the dimensions of the rectangle containing all thumbnails could be better implemented, but the mathematics are fairly complex (for a non-mathematician like me) and I ran out of time in the single R&D day that I had available. The current implementation starts at an upper bound estimate for the dimension and iterates back linearly. One of my colleagues is married to a mathematician and she pointed out that it would be better to also use the lower bound and a binary search between the two bounds.
When I have time I'll look at your solution at codeplex, but I regret that I have only one scheduled R&D day per 4 weeks, so it might take a while. When I was researching for my idea, I found a project that generates a scene xml and lets the deepzoom command line do the rest, was that yours?
I very much like the hierarchical organization of your conference site, it uses the capabilities of DeepZoom much better than my crude linear lay-out. I'll consider implementing something like that for a dynamic set of documents to be shown in a deepzoom collection for the more distant future, it certainly is a good idea and well worth using als inspiration.
|
|
|
|

|
Hi,
It could have been my project. However, I'm not 100% sure it maps onto yours. I have a "Visual" class which can contain other jpegs. I use that to build up my scene. And then I render it to an XML file that is uses as input to the command line tool.
According to the forums for the Composer tool, they want to provide an API to their tool eventually. The big missing feature in my opinion is the lack of multi-threaded support - the progress is a real CPU hog!
I am sure one can make use of DZ even better for visual organization -- that organization was just the first thing that came to mind. My next task is to clean it up and turn it into a web site.
I saw the new tagging abilities. I started my project when beta 1 was out, so the tagging wasn't there -- so it never made it into my design. I'd love to add that, but then I have to figure out how to match search terms in PDF documents with image locations. I'm sure it can be done.
I know what you mean about the 1 day per 4 weeks thing. I do this in my spare time. You did _a lot_ in one day. It has taken me a lot longer to get mine to the point you see it in that link.
|
|
|
|

|
I am not sure about Microsoft, but I for one will certainly consider a multi-threaded implementation and I believe my code organisation is suitable for it (I used only local variables, not member variables to keep bitmap list and path data in the generation function, with that in mind).
The data model begs for a multi-threaded approach and I did some try-outs that indicate that the viewer handles missing tiles and/or thumbnails fairly ok. I had a talk with my team coordinator about this subject today (he is the guy married to the mathematician btw). Our idea is to generate documents on the fly and already display them on the client when the server has generated the first few pages. When the user reads the first pages, the server has time to generate the rest. Perhaps I can do the thumbnails first, then if user zooms out, he even has overview over the document before it is complete.
About the 1 day thing... I must confess that I actually used the period from Friday 8 am until Saturday morning 3 am to get the thing to this level . The bulk of the codeproject article I wrote during the UEFA cup final on Sunday night and I must say that I can't remember much of the soccer match ...
|
|
|
|

|
Ha! Most people I know over here forgot their passwords during that match!!
The generation-on-the-fly is an excellent idea. I'd not thought about that. When I render a full conference with 1500 slides in it, it can take 5 hours or so.
Microsoft said they had turned on multi-threading just before they were going to make that latest release, but then found some multi-threading bugs in the underlying graphics engine. They were non-committal about when they would have that fixed. But the senariou you mentioned -- generating images on the fly -- was one that they have mentioned as well -- so I suspect they are trying to work towards that as well.
The multi-scale-image control is clearly very multi-threaded. It sucks up every availible CPU cycle on my dual core machine when looking at the image. So that part isn't too bad.
|
|
|
|

|
Nice work Berend! I haven't tried your code yet but I plan to give it a whirl in the next few days.
By the way, I noticed that you mentioned my site (Project Silverlight) in your reply and this is how I found your article. And I am glad I did! Just today I was planning to start on a thumbnails generator - so that it would be possible to add more images to a collection, without regenerating all the tiles, but your post is going to save me the trouble.
Thanks again!
Wilfred Pinto
http://projectsilverlight.blogspot.com
|
|
|
|

|
It will be interesting to see the result. I thought your work on client-side scene manipulation was well worth mentioning, it is definitely something that I will need in my future "scan viewer", and yours was the best example I encountered.
What I would love to do is to start out with an organization having al string of side by side pages, like a book scroll, zoomed to the vertical dimension of the page, like this: [^]. Then, when the user zooms out, at some threshold (e.g., when the viewport height is more than twice the displayed page height) rearrange the client scene to a thumbnail collection, like this: [^]. I think something like that should be possble, as the mouse wheel support is not in the control but in my own app, but I have not looked at the client code yet at all (as you can see from my basic "viewer" sample). Do you think I am right?
modified on Wednesday, July 2, 2008 1:04 AM
|
|
|
|

|
That is definitely doable! I will post an example on my blog if I get some time. Like you, I too have a full time demanding job, and get very little time to play with this stuff. Nevertheless, my blog contains all the pieces necessary to get this to work (except maybe the mouse scroll detection part).
Have you considered codeplexing this code (www.codeplex.com)? That way you can source control your changes and invite other people, including designers, to enhance your code.
Wilfred Pinto
http://projectsilverlight.blogspot.com
|
|
|
|
|

|
Hello Wilfred,
Your new sample is what I had in mind. Thanks a lot!!
I'll look into a codeplex submission, it does make sense. The API of the class is now just enough to support the sample, nothing more. It could do with decent xml handling, then code to get and set page images, etc. What would be nice is to just have a collection of PageBitmap objects that can be manipulated at will, but that would be of course a substantial amount of work at the back end.
What about licensing on codeplex? I do like the license that codeproject suggests, as it s truly non-restrictive and I'd like to publish related code under a similar license (in the past I used the BSD license to publish freeware and one open source thing that I made).
|
|
|
|

|
Berend,
You can choose from a list of licenses on codeplex so you can make it as restrictive/non-restrictive as you want. I also am a big proponent of non restrictive open source so I am glad this is the route you decided to take. I see great potential for your project.
Wilfred Pinto
http://projectsilverlight.blogspot.com
|
|
|
|

|
Thanks, that is what I was hoping for . It might take another week, but it will definitely appear at codeplex.
|
|
|
|

|
Neat
Sacha Barber
- Microsoft Visual C# MVP 2008
- Codeproject MVP 2008
Your best friend is you.
I'm my best friend too. We share the same views, and hardly ever argue
My Blog : sachabarber.net
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
|
Fast generation of DeepZoom image tile sets, collection thumbnails, and XML data in managed code without using external tools.
| Type | Article |
| Licence | CPOL |
| First Posted | 29 Jun 2008 |
| Views | 85,113 |
| Downloads | 1,358 |
| Bookmarked | 44 times |
|
|