.net - How can I resize an image in C# while retaining high quality? -


i found article on image processing here: http://www.switchonthecode.com/tutorials/csharp-tutorial-image-editing-saving-cropping-and-resizing works fine.

i want keep high quality when resizing image. think if can increase dpi value can achieve this. know if possible? , if so, how can implement in c#?

for starters, it's worth pointing out there 2 general categories of images; vector [e.g. svg, wmf, adobe illustrator , corel draw graphics] , bitmap (also called raster) images [e.g. bitmap, jpeg , png images].

vector images formed series of mathematical equations and/or calculations. bitmap images, on other hand, made of individual dots (pixels) each corresponding particular feature on object image taken of.

if should happen want resize image, first thing consider if bitmap or vector image. virtue of fact vector images obtained calculations, can resized without losing detail. case different bitmap images. since each pixel independent of other, when desire resize it, increasing or decreasing source target pixel ratio.

so in order double size of vector image, multiply target dimensions 2 , comes out right. if should apply same effect on bitmap, increasing each source pixel cover 4 pixels (two rows of 2 horizontal pixels).

of course, applying interpolation , filtering, computer can "smooth" out edges of target pixels seem blend each other , give appearance of reasonably resized image output never same resizing vector image; vector images resize perfectly.

you mentioned dpi in question. dpi number of pixels correspond inch when image printed not when viewed on screen. therefore increasing dpi of image, not increase size of image on screen. increase quality of print [which needless depends on maximum resolution of printer].

if desire resize image , image bitmap, rule of thumb, not increase size beyond 200% of original image's size else you'll lose quality.

you can see this answer code resize bitmap images.

to see sample vector image, go this link.
note try zooming in , out of image see how resizes.

a typical bitmap stackoverflow sprites. not keep quality resized.


further reading


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -