none
Image zooming in WPF

    Question

  • Hello, please help!

    I need to perform a zoom on an image, how can I do this? I currently have a bitmap stored in a BitmapSource object and this object is held inside a Rectangle object. I tried to implement zoom in and zoom out functionalities, but all I did was resize my Rectangle, increasing or decreasing its height and width, which of course gives the impresion of zooming in and out the image, since it is displayed bigger or smaller. But this is obviously not what zooming is meant to be, for my image only becomes more blurry when it grows, I'm not sure if I made my point clear.
    Please tell me how to perform zooming on a bitmap image or if there is a sample somewhere that could be useful.

    Thanks a lot!
    Best regards,
    Diego V.

    Monday, March 26, 2007 11:05 PM

Answers

All replies

  • may be (my) similar question ... how do you implement application zoom in your WPF app?
    Monday, March 26, 2007 11:34 PM
  • You can use the scale transform. See http://msdn2.microsoft.com/en-us/library/ms742560.aspx.
    Tuesday, March 27, 2007 2:08 AM
  • Hello, are you sure that ScaleTransform will provide me with what I need? because I believe that what it does is the same thing I was mistakenly doing, which is merely resizing the image to a bigger or smaller size, but it doesn't "zoom" the image.
    For example, if I have an image that say shows a house from afar, the house would look like a tiny square, but increasing the image's size will only display the same square bigger, whereas zooming in the image will display the house in detail. That's what I'm looking for, I hope you can help me out.
    Thanks a lot! best regards.

    Diego V.
    Tuesday, March 27, 2007 3:40 PM
  • Maybe try image scaling inside ScrollViewer.
    Wednesday, March 28, 2007 6:37 AM
  • ok, how do I try that? because what I am developing is a bitmap viewer, so I need to perform multiple zoom-ins and zoom-outs. I would appreciate it if someone can tell me where to find a sample code for this.

    thanks!
    Diego V.
    Wednesday, March 28, 2007 12:38 PM
  • I think you're asking how to 'enhance' an image rather than zoom an image (since you're already zooming correctly). In short, it is basically impossible, don't believe what you see on TV.
    Monday, May 07, 2007 7:30 AM
  • Hello Diego,

    How did you do that, where it gets so large in the image, that it looks blurry, thats what I am looking for. I am using image object, and I am having a hard time getting mine to work, if you can give me what you got then it might help me out with my program.

    Thank you
    Tuesday, December 23, 2008 3:16 AM
  • There's a solution to this at http://londonelegance.com/tyburn-consultancy/wpf/ 

    The user can zoom in on an image and scroll around in a way that seems to address your need.
    Saturday, June 06, 2009 4:56 PM