bootchk / resynthesizer

Suite of gimp plugins for texture synthesis
GNU General Public License v3.0
1.39k stars 164 forks source link

Enhance enlarge by resynthesis #126

Open bootchk opened 9 months ago

bootchk commented 9 months ago

Just an idea.

For people who like to write plugins and experiment with image algorithms.

Currently, the "Enlarge by resynthesis" plugin works like this: it enlarges the image conventionally (which interpolates using a conventional kernel filter.) That kernel might give new color values to all pixels in the image, even the originals. (You should check that assertion, my conception could be wrong.) Then it resynthesizes the whole image, from itself.

A better algorithm might be to add rows and columns to the image, between each pair of pixels. Then select those new empty rows and columns, and synthesize those. Thus the algorithm retains the original color values for the original pixels, which the previous algorithm does not. The new pixels are synthesized by patch matching, which might plausibly give a better result. The new pixels would have color values that were originally in the image (it would not interpolate color values.) The result image might still look grainy (since no interpolation was done.) Again, the color map (set of distinct colors) is not changed.

Simpler to think about when scaling factor is two. More complicated for other fractional and integral scaling factors.

I don't think this is very important. Simple scaling seems to work as well as enlarging with resynthesis. The new algorithm also probably won't work any better than simple scaling, at least as far as most viewers perceive.

One reason I can think of doing this is for indexed images (using a color map.) But the resynthesizer doesn't accept indexed images. That might be a separate issue, there is no reason it shouldn't. I