My only solid recommendation at this point is this:

In resize.c, replace the blur for LanczosSharp from the current value (which is barely different from 1) to the following:

0.88549061701764

(I'll triple check the exactness of this value when I have more time.)

In 8 bit (data in [0,255]) the maximum change of a pixel value under no-op is 82. (Some of my ealier reported values may have been off by half. I'll have to go back and check all of these bounds.)

I have mentioned this value before. At the time, I was more concerned about preserving vertical/horizontal data under no-op than the worst case deviation under no-op.

This blur value minimizes the worst case deviation under no-op. It (or, rather, its reciprocal) was found using this axiom code:

Code: Select all

```
)cl a
digits 100
R1 := 3.831705970207512315614435886308160766564545274287801928762298989918839309519011470214112874757423127
r1 := R1 / %pi
R3 := 10.17346813506272207718571177677584406981951250019168555611465006811578704378288387382891893264510929
r3 := R3 / %pi
jinc x == besselJ(1,%pi*x)/x
sinc x == besselJ(1,x*(R1/r3))/x
l x == if (x<r3) then ( sinc(x) * jinc(x) ) else 0.
plus x == max(l x,0)
minus x == -min(l x, 0)
f r == [ r, sqrt(1.+1)*r, 2*r, sqrt(1.+4)*r, sqrt(4.+4)*r, 3*r, sqrt(9.+1.)*r, sqrt(9.+4)*r, 4*r, sqrt(16.+1)*r, sqrt(9.+9)*r, sqrt(16.+4)*r, 5*r ]
z := l 1.e-128
gplus(r) == _
( _
4 * _
( plus((f(r)).1) _
+ plus((f(r)).2) _
+ plus((f(r)).3) _
+ plus((f(r)).5) _
+ plus((f(r)).6) _
+ plus((f(r)).9) _
+ plus((f(r)).11) _
+ plus((f(r)).13) _
+ 2 * _
( plus((f(r)).4) _
+ plus((f(r)).7) _
+ plus((f(r)).8) _
+ plus((f(r)).10) _
+ plus((f(r)).12) ) ) _
) / _
( _
z + _
4 * _
( l((f(r)).1) _
+ l((f(r)).2) _
+ l((f(r)).3) _
+ l((f(r)).5) _
+ l((f(r)).6) _
+ l((f(r)).9) _
+ l((f(r)).11) _
+ l((f(r)).13) _
+ 2 * _
( l((f(r)).4) _
+ l((f(r)).7) _
+ l((f(r)).8) _
+ l((f(r)).10) _
+ l((f(r)).12) ) ) )
gminus(r) == _
( _
4 * _
( minus((f(r)).1) _
+ minus((f(r)).2) _
+ minus((f(r)).3) _
+ minus((f(r)).5) _
+ minus((f(r)).6) _
+ minus((f(r)).9) _
+ minus((f(r)).11) _
+ minus((f(r)).13) _
+ 2 * _
( minus((f(r)).4) _
+ minus((f(r)).7) _
+ minus((f(r)).8) _
+ minus((f(r)).10) _
+ minus((f(r)).12) ) ) _
) / _
( _
z + _
4 * _
( l((f(r)).1) _
+ l((f(r)).2) _
+ l((f(r)).3) _
+ l((f(r)).5) _
+ l((f(r)).6) _
+ l((f(r)).9) _
+ l((f(r)).11) _
+ l((f(r)).13) _
+ 2 * _
( l((f(r)).4) _
+ l((f(r)).7) _
+ l((f(r)).8) _
+ l((f(r)).10) _
+ l((f(r)).12) ) ) )
-- To find the one with least possible deviation (this is a converged result):
[ gplus(1+.00000000000000001*i) - gminus(1+.00000000000000001*i) for i in 12931744366533334..12931744366533349 ]
```

Now, with this blur, EWA LanczosSharp is a bit too aliased to my taste. It is also just a touch sharper than orthogonal Lanczos 3. On the other hand, "plain" EWA Lanczos is a bit too soft for my (and most people's) taste. I just don't know how to attach a "less than 1 but more than .88" blur value to EWA Lanczos without adding yet one more exception. So, I'll leave aside the issue of how to "officially" put a balanced value in IM for now.

With the usual test pictures, here is the code that generates the results:

Code: Select all

```
convert sl.png -define filter:filter=Jinc -define filter:window=Jinc -define filter:blur=0.88549061701764 -define filter:lobes=3 -distort Resize 3000% sl_JincJinc3blur0p885469.png
convert rose: -define filter:filter=Jinc -define filter:window=Jinc -define filter:blur=0.88549061701764 -define filter:lobes=3 -distort Resize 3000% rose_JincJinc3blur0p88549.png
```

Although I am not 100% satisfied with my attempt at thinking outside of the zero sum box, one thing is clear (at least to me): The above LanczosSharp (with blur=.88...) is unquestionably better than classical orthogonal Lanczos with pixel art (which is not saying much, I'll admit). In natural images, it appears to do better than classical Lanczos 3 with diagonal interfaces and lines (which is not much of an achievement) at the expense of straightening nearly vertical and horizontal interfaces and lines a little too much to my taste. This gives results a slightly "boxy" look compared to classical Lanczos (which, once again, "breaks" near diagonal lines and interfaces; the two methods are kind of complementary).

In any case, this whole thread is about exploratory work, so the door is wide open for criticism of the results and the methods.