Fractal image scaling with Python
Asked Answered
I

3

5

I am in a position where relatively low resolution images are provided (via an API, higher resolution images are not available) and high resolution images need to be generated.

I've taken a look at PIL and it's just great for about everything... Except scaling up images.

It has the common resizing algorithms:

  • Nearest Neighbor
  • Bilinear
  • Bicubic
  • Anti-aliased

I would like to use Fractal Resizing (as per jeff's post on coding horror), but alas, PIL has no support for this kind of resizing.

Further Google searches yield no alternative libraries to provide fractal image resizing either.

Does such a thing exist or do I really have to buckle down and write my own fractal resizing algorithm?

I'm no expert but from my current vantage point, that looks like a pretty steep learning curve :(

If no such library exists, maybe you have some advice where to learn about fractal compression algorithms?

Ikey answered 17/11, 2009 at 17:2 Comment(0)
C
9

There are algorithms, and you're definitely not going to find them in Python. To start with, you can take this paper :

Daniel Glasner, Shai Bagon, and Michal Irani, "Super-Resolution from a Single Image," in Proceedings of the IEEE International Conference on Computer Vision, Kyoto, Japan, 2009.

It is very much state of the art, highly sophisticated, and producing promising results. If you ever make it into a python implementation please release it to the public :)

Charmion answered 17/11, 2009 at 17:9 Comment(1)
I absolutely will... if I can convince my boss haha (I have a feeling if it looks like it'll take more than a few days to write, we'll just use a cgi or something. this isn't our core business)Ikey
H
2

Fractal-based image scaling is still quite unusual and hasn't settled down onto one accepted-best algorithm yet. I'm afraid you aren't going to find it in standard image processing libraries yet.

It's also not invariably preferable to bicubic. It can have artefacts which will be undesirable for some kinds of images. For me, Jeff's example image looks a bit weird and unnatural around the sharp edges like the right-hand-side of the nose. Better for some values of ‘better’, sure, but I wouldn't blanket-apply it to all my images.

(This is the case with other ‘advanced’ upscaling techniques, too, including the better-known and more widely-implemented Lanczos/Sinc method.)

Haney answered 17/11, 2009 at 18:48 Comment(0)
P
1

Check out this solution using Residual Dense Networks: https://github.com/idealo/image-super-resolution

Good documentation and rather easy to implement. They even have docker builds and google collab notebooks available. See the docs

Pantheas answered 21/1, 2021 at 20:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.