GithubHelp home page GithubHelp logo

nichoth / avif.io Goto Github PK

View Code? Open in Web Editor NEW

This project forked from loki315zx/avif.io

0.0 1.0 0.0 43.12 MB

Convert all images to AVIF for free. No data is sent. The magic happens in your browser.

Home Page: https://avif.io

Shell 0.05% JavaScript 64.50% Rust 3.13% TypeScript 29.80% CSS 2.43% Makefile 0.09%

avif.io's Introduction

avif.io

This Github repo is the source code behind the website avif.io. You can use avif.io to convert a wide variety of file formats into AVIF, directly inside your web browser.


Advantages

  1. Converted files are never sent to the server
  2. The entire conversion process is performed locally
  3. Unlimited conversions, even in bulk
  4. Flexible and userfriendly interface
  5. Options to change quality and effort

How does the conversion work?

We use Rust with wasm-pack to compile a converter library into WASM and call the Rust code in the browser, from a WebWorker. The program uses Rust's image library to decode files, and for encoding to AVIF we use a fork of rav1e modified to allow for proper progress updates. The Rust code is in conversion/.



Technical Details


Frontend Code

The root of the project is a Next.js application written in TypeScript, based on React and Preact. You can run the application via npm start, and watch and reload the files via npm develop. The wasm-packed Rust code ends up in public/dist.


Rust Code

Building Rust requires cargo and make. To build the wasm code for release, use:

cd conversion/
make wasm

This will also run webpack to move the produced WASM and JS files to public/dist. Keep in mind that when you clone the repository the Rust code will already have been compiled, so you don't have to do this step yourself.

Using make, you can use make wasm-debug to build the WASM code for debugging, or use make demo-debug to build a demo binary to test out the Rust code in a non-WASM environment.


WebP

At the time of writing, the image library hasincomplete support for the WebP format. Instead, we use a special build of libwebp called webp_js, which allows us to decode WebP files in the browser using the canvas web API. This is important to keep in mind — WebP handling is a special case at the moment, so don't be surprised that some of the code is explicitly checking whether it's working with WebP.


Installing dependencies and building the front-end

You can find the related commands in the package.json file.


Special thanks to all contributors:

  1. ennmichael / Nikša
  2. mikqi / Muhammad Rivki
  3. ageofadz / Sam Robertson
  4. styfle / Steven

avif.io's People

Contributors

0xc0000054 avatar ageofadz avatar justinschmitz97 avatar kamillagarifullina avatar lapo-luchini avatar mikqi avatar sipho-w-mokoena avatar sistemd avatar styfle 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.