Git Product home page Git Product logo

cole8888 / nearest-neighbour-upscale Goto Github PK

View Code? Open in Web Editor NEW
7.0 1.0 2.0 812 KB

C program to quickly perform nearest neighbour image scaling to upscale 24bit or 32bit PNG images. Upscale functions should work with any image format if you can extract the values of each pixel in the image into a u_char array.

License: MIT License

C 74.73% C++ 25.05% Makefile 0.22%
upscaling upscale upscaler c png image images

nearest-neighbour-upscale's Introduction

Nearest-Neighbor-Upscale

C program to quickly perform nearest neighbour upscaling of an image. Example driver code works on 24bit or 32bit PNG images. Upscaler functions should work with any image format if you can extract the values of each pixel in the image into a u_char array.

To use the example driver code:

  • git clone https://github.com/cole8888/Nearest-Neighbour-Upscale
  • cd Nearest-Neighbour-Upscale
  • make
  • ./NearestNeighbourUpscale <INPUT_IMAGE.PNG> <SCALE>
    • Where <INPUT_IMAGE.PNG> is the image you want to upscale and <SCALE> the the scale you want to upscale it by.

How it works:

For this example we will take this 25x25px image and upscale it to 50x50px.

(Please note I've upscaled the images in this demo by 10x so that they can easily be viewed without zooming in.)

upscaled_img79

  • Step 1: Copy the pixels from the original image into the top left corner of each expanded pixel 0624

  • Step 2: Fill in the top row of each expanded pixel with the data from the topleft-most pixel in that expanded pixel. 1249

  • Step 3: Fill in the remaining rows of each expanded pixel with the top row of each expanded pixel. 2499

(See the VIDEO_DEMOS directory if you'd like a visual representation.)

The example driver code uses lodepng which can be found here https://github.com/lvandeve/lodepng

nearest-neighbour-upscale's People

Contributors

bartimaeusnek avatar cole8888 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.