Create a Thumbnail Image Companion for a MultiScaleimage Control

234 views Asked by At

I have an application that uses a MultiScaleImage control and I would like to add a thumnbnail window with the unzoomed image and a rectangle outline indicating the portion being viewed in the MultiScaleImage control. I don't have thumbnails for the images but want to create them at runtime.

1) is there a way to get a copy of the unzoomed image from the MultiScaleImage control to put into an Image control or do I have to just use another MultiScaleImage control with the same Source.

2) Any hints or examples would be appreciated.

David

2

There are 2 answers

1
David Rogers On

Use the WriteableBitmap class. If multiscaleImage is a MultiscaleImage control and thumbnail is an Image control, then this code will capture the image from the former and display it in the latter.

WriteableBitmap bitmap = new WriteableBitmap(multiScaleImage, null);
Thumbnail.Source = bitmap;

David

1
George Birbilis On

Please see Jeff Prosise's blog post on this, use the last function he suggests:

http://www.wintellect.com/CS/blogs/jprosise/archive/2009/12/17/silverlight-s-big-image-problem-and-what-you-can-do-about-it.aspx

you could adapt it appropriately (has the added benefit that it won't need to render the whole huge image in memory, it should render it directly scaled so MultiScaleImage would use the correct zoom level data for that small scale)