Open AlanDeSmet opened 5 years ago
I'm happy to take a crack at the second proposal I made above, but before I dive in, I'd like to know if you'd welcome it. :-)
I think the general algorithm should be as follows:
The main problem with 2 might be that we might not know the best background color... perhaps just use the bottom right corner pixel color? Or just black or white?
Given the attached files, I'd expect some sort of output, but tiv reports nothing.
5x5 4x4 3x3 2x2 1x1
I believe this applies to any image less than 8 pixel tall or 4 pixels wide. Ideally, something should be rendered for these tiny images.
I'm imaging two options:
My initial thought was to rescale the image so it's at least 4x8. This commit does exactly that. It's the only commit on the branch fix-tiny.
However, I'm now thinking of a different approach: If the image is smaller than target window in both directions, scale up to fill the space, but limit the scale to the the largest integer that won't cause the image to exceed the allotted space. Also use nearest neightbor interpolation. The result should provide larger "pixels". On the down side, this approach won't work for images that are very narrow but tall or very wide but short. That may yet require special case logic.