{"id":42960436,"url":"https://github.com/vaisest/bicubic-intepolation-py","last_synced_at":"2026-01-30T23:03:06.433Z","repository":{"id":203944560,"uuid":"710665528","full_name":"vaisest/Bicubic-intepolation-py","owner":"vaisest","description":"Bicubic convolution interpolation implementation in Python and Rust from Keys, 1981","archived":false,"fork":false,"pushed_at":"2024-03-26T19:08:40.000Z","size":65,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-03-26T20:27:39.594Z","etag":null,"topics":["bicubic-interpolation","bicubic-kernels","image-processing","image-scaling"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vaisest.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-10-27T07:16:54.000Z","updated_at":"2023-12-02T22:49:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"ec3e727b-828a-45a5-88fc-e15acc741a78","html_url":"https://github.com/vaisest/Bicubic-intepolation-py","commit_stats":null,"previous_names":["vaisest/bicubic-intepolation-py"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/vaisest/Bicubic-intepolation-py","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaisest%2FBicubic-intepolation-py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaisest%2FBicubic-intepolation-py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaisest%2FBicubic-intepolation-py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaisest%2FBicubic-intepolation-py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vaisest","download_url":"https://codeload.github.com/vaisest/Bicubic-intepolation-py/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaisest%2FBicubic-intepolation-py/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28922232,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-30T22:32:35.345Z","status":"ssl_error","status_checked_at":"2026-01-30T22:32:31.927Z","response_time":66,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bicubic-interpolation","bicubic-kernels","image-processing","image-scaling"],"created_at":"2026-01-30T23:03:05.599Z","updated_at":"2026-01-30T23:03:06.427Z","avatar_url":"https://github.com/vaisest.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bicubic interpolation in Python and Rust\n\nThis repository contains an image scaling implementation using the bicubic convolution interpolation algorithm written in Python for learning purposes. As the Python version is unusably slow, there is also a Rust implementation included that is quite fast and which might be useful for quickly scaling a large amount of images. Using `RUSTFLAGS='-C target-cpu=native` might be useful as there is no manual SIMD usage, but the Rust code works well with auto vectorization, resulting in doubled performance in my tests.\n\nThe method was originally introduced in [Cubic convolution interpolation for digital image processing](https://ieeexplore.ieee.org/document/1163711) by R. Keys in 1981. The method works using the function\n$$g(x, y) = \\sum_{l=-1}^2 \\sum_{m=-1}^2 c_{i + l,j + m} u(dx + l) u(dy + m),$$\nwhich produces a new value for a position $(x, y)$ in the new image by scaling these coordinates back to the dimensions of the source image as $(i, j)$, and then by summing the nearest 16 pixels. The weights are calculated using each pixel's distance using the function $u$ which is known as the interpolation kernel. There are multiple kernels available, but for example the one used in Keys' research was \n```math\nu(s) = \\begin{cases}\n        \\frac{3}{2} \\left| s \\right|^3 - \\frac{5}{2} \\left| s \\right|^2 + 1                       \u0026 0 \\leq \\left| s \\right| \u003c 1 \\\\\n        -\\frac{1}{2} \\left| s \\right|^3 + \\frac{5}{2} \\left| s \\right|^2 - 4 \\left| s \\right| + 2 \u0026 1 \\leq \\left| s \\right| \u003c 2 \\\\\n        0                                                                                         \u0026 \\text{else}.\n    \\end{cases}\n```\nSome other kernels like the Mitchell-Netravali filter are also implemented. Generally different kernels affect the sharpness of the produced image. For more information on reconstruction filters / kernels see [ImageMagick's documentation](https://imagemagick.org/Usage/filter/).\n\u003c!-- ```txt\n$ echo \"1280x720 -\u003e 2560x1440\"; hyperfine --warmup 1 'python ../scaling.py -s 2 ../test_720p_wp.png ../out_py.png'\n1280x720 -\u003e 2560x1440\nBenchmark 1: python ../scaling.py -s 2 ../test_720p_wp.png ../out_py.png\n  Time (mean ± σ):     36.361 s ±  0.467 s    [User: 83.620 s, System: 0.728 s]\n  Range (min … max):   35.881 s … 37.533 s    10 runs\n```\n\n```txt\n$ echo \"1280x720 -\u003e 2560x1440\"; hyperfine --warmup 1 '.\\target\\release\\bicubic_rs.exe -s 2 ../test_720p_wp.png ../out_rs.png'              \n1280x720 -\u003e 2560x1440\nBenchmark 1: .\\target\\release\\bicubic_rs.exe -s 2 ../test_720p_wp.png ../out_rs.png\n  Time (mean ± σ):     625.0 ms ±   4.3 ms    [User: 493.8 ms, System: 9.4 ms]\n  Range (min … max):   619.3 ms … 632.9 ms    10 runs\n```\n60 times faster\nMake sure to use `RUSTFLAGS='-C target-cpu=native'` as at least on my system (5800X3D) this more than doubles execution speed.\n--\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaisest%2Fbicubic-intepolation-py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvaisest%2Fbicubic-intepolation-py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaisest%2Fbicubic-intepolation-py/lists"}