Google Answers Logo
View Question
Q: algorithm to zoom images ( Answered 5 out of 5 stars,   0 Comments )
Subject: algorithm to zoom images
Category: Computers > Algorithms
Asked by: patrickdang-ga
List Price: $20.00
Posted: 15 Oct 2006 10:34 PDT
Expires: 14 Nov 2006 09:34 PST
Question ID: 773698
Could you pleased give me some information about algorithms to zoom
images? I need it for my project.
Subject: Re: algorithm to zoom images
Answered By: maniac-ga on 15 Oct 2006 14:04 PDT
Rated:5 out of 5 stars
Hello Patrickdang,

There are several good algorithms and/or source code implementations
for image magnification. You did not specify any constraints (such as
fixed magnification steps, allowing unequal X/Y zoom, speed, gray
scale / color, or licenses), so I will give you several examples that
you can choose from. If you have additional constraints - please make
a clarification request so I can find a solution that more closely
fits your project.

At the low end, there are methods such as pixel replication or pixel
decimation (eliminating "chosen" pixels) to generate larger and
smaller images respectively. These are fast but generally introduce a
number of artifacts that are visible to the viewer.

Slightly more complex methods include image averaging or
interpolation. There is a good summary of interpolation at
which has a number of images illustrating the differences in several methods.

More advanced methods are generally adaptive - attempting to detect
edges or other significant changes in an image to either speed up the
processing or to ensure the edges or other signficiant changes remain
sharp. The hq3x example below appears to be in this category.

For papers on these algorithms, I suggest
 - your local university library
 - the on line journals at IEEE or ACM (if a member)
 - a search at Citeseer (

For implementations and other information, here are a few good references.

hq3x Magnification Filter
This is an interesting implementation of a fixed zoom (3x in this
case) solution. In brief, it examines the 8 adjacent pixels to each
pixel and based on the relative color difference to determine the mix
of colors to be used in the 9 destination pixels (the 3x zoom). There
is companion code for 2x and 4x zoom - if interested, I may be able to
suggest methods to adapt to other zoom factors.
An implementation in Java using built in capabilities of Java to
convert a larger image into a "thumbnail" size. Size of the input
image is "automatic", you can set the size of the thumbnail &
"quality" settings for the output file.

ImageMagick can do a lot more than zoom an image and is callable from
a number of languages (C, C++, Java, Perl, Python, etc.).

Another general purpose package - includes support for several
different file formats and has complete source code (C).

Color Averaging
Some commentary and source code describing methods to average colors
(a method used frequently in image resizing algorithms). You may want
to look at the other articles posted here that may be helpful as well
(e.g., on perception of colors or "Color Metric").

Geometric Scaling Tutorial
Part of the "Hypermedial Image Processing Reference" at
Has several good links / images that illustrate the basic concepts and
the differences in results.
For additional references, try searches using phrases like
  source code image magnification
  algorithm image magnification
  image scale source code
  image zoom source code
  adaptive image interpolation algorithm
  [algorithm name] image description
  image processing tutorial

If any part of the answer is unclear or you need additional
information on some aspect of your question - please make a
clarification request. I would be glad to help.

Good luck with your project.
patrickdang-ga rated this answer:5 out of 5 stars and gave an additional tip of: $15.00
Thank you very much for this answer! This is REALLY helpful to me!

There are no comments at this time.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  

Google Home - Answers FAQ - Terms of Service - Privacy Policy