DrawImage problem (not retaining the pixel configuration)

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hello Guys,

Iam working on a zoom in and out tool and here is the code iam using for it
//Method for zooming in

Bitmap bmpSource=new Bitmap(ImgBox.Image);
Bitmap bmpZoomed=new
Bitmap(bmpSource.Width*ZoomInFactor,bmpSource.Height*ZoomInFactor);

Graphics grZoom=Graphics.FromImage(bmpZoomed);
grZoom.InterpolationMode=InterpolationMode.HighQualityBilinear;
grZoom.DrawImage(bmpSource,0,0,bmpZoomed.Width+1,bmpZoomed.Height+1);
ImgBox.Image=bmpZoomed;

//Method for zooming Out

Bitmap bmpSource=new Bitmap(ImgBox.Image);
Bitmap bmpZoomed=new
Bitmap(bmpSource.Width/ZoomInFactor,bmpSource.Height/ZoomInFactor);

Graphics grZoom=Graphics.FromImage(bmpZoomed);
grZoom.InterpolationMode=InterpolationMode.HighQualityBilinear;
grZoom.DrawImage(bmpSource,0,0,bmpZoomed.Width+1,bmpZoomed.Height+1);
ImgBox.Image=bmpZoomed;

It is working fine but the picture resulution is lost if we do symultaneous
multiple zoomin and zoom out..Specially if you zoomout first and then zoom
in...
Any ideas on how to retain the pixel configuration ....
Any valuable thought should help

Cheerz,
Ajay
.



Relevant Pages

  • how to retain pixel configuration while zooming in or out
    ... Iam working on a zoom in and out tool and here is the code iam using for it ... Bitmap bmpSource=new Bitmap; ... //Method for zooming Out ...
    (microsoft.public.win32.programmer.gdi)
  • Re: how to retain pixel configuration while zooming in or out
    ... Instead of zooming the current image, ... the original image to the new zoom factor. ... > Bitmap bmpSource=new Bitmap; ...
    (microsoft.public.win32.programmer.gdi)
  • Re: DrawImage problem (not retaining the pixel configuration)
    ... The problem is that you are altering an image and storing in in an ImageBox object and then using the same image to zoom out from. ... It would be better to store a copy of the original bitmap somewhere in your code and base the scaling operation on that copied image. ... Iam working on a zoom in and out tool and here is the code iam using for it ... multiple zoomin and zoom out..Specially if you zoomout first and then zoom ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Question for Larry Serflaten...
    ... My images from the ListImage and the lines are drawn direct on my form. ... Just declare ZoomFactor As Double, set it initially to 1.0, then multiply ... you notice that the zoom center is ... coordinates before zooming, example: ...
    (microsoft.public.vb.general.discussion)
  • DPI PPI or resolution. I want HIRES
    ... And have it visible after zooming out .. ... Yet that's what 99% of the images on the web are.. ... zoom in and paint every facet of a fly's eye, ... For now I'm starting to use 300 DPI on the images I'm drawing. ...
    (alt.graphics.photoshop)