AngusJohnson/Image32

BicubicResample() and tiny height

Closed this issue · 4 comments

A tiny img-height (at least the case of 1 pixel) can cause pi being out of range in img.Pixels[pi].

I suspect the problem isn't in the BicubicResample function but in its calling function.
What is the size of your source image, and what is the size of the intended target (ie resized) image?

The SrcImg has (width = 100), (height = 1). The (unoptimized) call is like this:

if (x256 >= 0) and (x256 < srcImg.width*256) and (y256 >= 0) and (y256 < srcImg.height*256) then begin
    if (y256 < 256) then y256 := 100; // ensure color of 1st line
    srcColor := resampler(srcImg, x256, y256);  
end;

Thanks. While investigating this I've discovered that my resampling code needs significant revision, and that will likely take a few days.

This should be fixed in the latest revision (where I've signficant;ly improved resampling of image edges).