npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mc_map2png

v0.1.0

Published

This Rust application transforms Minecraft map data from NBT format into a visual PNG image. Additionally, a WebAssembly module is available for converting images on the client side.

Downloads

3

Readme

Minecraft Map to PNG Converter

This Rust application transforms Minecraft map data from NBT format into a visual PNG image. Additionally, a WebAssembly module is available for converting images on the client side.

Features

  • Convert compressed Minecraft map NBT files to PNG images.
  • Direct memory-based image processing suitable for web assembly integration.
  • Efficient error handling and informative error messages.

Demo Site

Demo Site

I provide a web interface that allows users to convert Minecraft NBT files to PNG images directly within their browser.

The website is built using HTML and Tailwind CSS for styling. It features a simple drag-and-drop interface for file upload, a convert button, and displays the resulting PNG image which can then be downloaded. The site runs entirely client-side, leveraging WebAssembly to perform image conversion.

WebAssembly Usage

To use the WebAssembly module, include the following steps in your web application:

  1. Initialize the WASM Module: First, ensure that the WASM module is loaded and initialized correctly. This is done by importing the initialization function and the specific functions you need from the generated WASM package.

    import init, { process_image_from_memory } from './path_to_wasm_package/mc_map2png.js';
    
    await init();
  2. File Processing: Convert user-uploaded files by reading them into an ArrayBuffer, then passing this buffer to the WASM function:

    const fileInput = document.getElementById('fileInput');
    const file = fileInput.files[0];
    const arrayBuffer = await file.arrayBuffer();
    const result = await process_image_from_memory(new Uint8Array(arrayBuffer));
  3. Displaying the Image: Upon successful conversion, display the image or handle errors appropriately:

    if (result instanceof Uint8Array) {
        const blob = new Blob([result], {type: 'image/png'});
        const url = URL.createObjectURL(blob);
        document.getElementById('outputImage').src = url;
    } else {
        console.error('Conversion failed.');
    }
  4. Download Option: Provide users with the option to download the generated PNG:

    const downloadButton = document.getElementById('downloadButton');
    downloadButton.onclick = () => {
        const link = document.createElement('a');
        link.href = URL.createObjectURL(new Blob([result], {type: 'image/png'}));
        link.download = 'converted-image.png';
        link.click();
    };

Installation

Clone the repository to your local machine:

git clone https://github.com/masaishi/mc_map2png.git
cd mc_map2png

Build the project using Cargo:

cargo build --release

Usage

To convert an NBT file to a PNG image, run:

cargo run --release -- <input_path> <output_path>

Where:

  • <input_path> is the path of Minecraft map NBT file. (e.g., map_0.dat)
  • <output_path> is the desired path for the output PNG file. (e.g., map_0.png)