(e-mail address removed)> wrote in message
persenaama ??:
Hi
I don't understand the fill-in sequence.
If i have a 2x2 pixels image:
Then i resize it to enlarge 100%, so i get
What is the sequence to fill the the ? (the unknown pixel)?
The correct term is "bicubic interpolation".
You can't add borders using this technique! You will have to choose what you
want: a border of a solid color, a wrap-around effect, or (usually) only
stretch inbetween pixels.
To stretch a value range (x1,x2) horizontally to (xn1,xn2), use this for
every value inbetween: new value = x1+(x2-x1)/(xn2-xn1) and calculate this
for each separate RGB component.
In ASCII art, your 4 top pixels again:
pixel number:
0 1 2 3
X [2/3X+1/3Y] [1/3X+2/3Y] Y
You can see pixel value #1 will be X+1*((Y-X)/3) = X - 1/3X + 1/3Y = 2/3X +
1/3Y
The same can be used for vertical scaling. You can do the horizontal and
vertical scaling in two separate passes, but the formula can be easily
adjusted to calculate *any* position inbetween.
There are lots and lots of optimizations that can be done, however, this
should get you started.
[Jongware]