Compare commits
8 Commits
Refactor3
...
noise-redu
| Author | SHA1 | Date | |
|---|---|---|---|
| 63bcf8532c | |||
| 47a9bf5c79 | |||
| d100473542 | |||
| d0946d3ab5 | |||
| 5ee1e908f1 | |||
| 5788baa0b8 | |||
| f135e184e4 | |||
| 21eb632d22 |
56
README.md
56
README.md
@@ -1,3 +1,57 @@
|
|||||||
# pixsy
|
# pixsy
|
||||||
|
|
||||||
convert images to rooms for use in Bitsy
|
a tool for [Bitsy Game Maker](http://bitsy.org).
|
||||||
|
upload any image and convert it into a room.
|
||||||
|
|
||||||
|
## credits
|
||||||
|
|
||||||
|
made by [Max Bradbury](http://tinybird.info/).
|
||||||
|
makes use of my own [bitsy parser](https://crates.io/crates/bitsy-parser) library.
|
||||||
|
|
||||||
|
uses the [Croppie](https://foliotek.github.io/Croppie/) image crop plugin
|
||||||
|
by [Foliotek](https://www.foliotek.com/)
|
||||||
|
|
||||||
|
uses [wasm-bindgen](https://crates.io/crates/wasm-bindgen) to automate WebAssembly bindings.
|
||||||
|
|
||||||
|
## thanks
|
||||||
|
|
||||||
|
to [Adam Le Doux](http://ledoux.io/) for creating the wonderful and inspiring Bitsy
|
||||||
|
|
||||||
|
to [Mark Wonnacott](https://kool.tools/) for their support, encouragement and inspiration
|
||||||
|
|
||||||
|
and to everyone in the bitsy community!
|
||||||
|
|
||||||
|
## contributing
|
||||||
|
|
||||||
|
forks and pull requests welcome!
|
||||||
|
|
||||||
|
### development prerequisites
|
||||||
|
|
||||||
|
* [rust/cargo](https://rustup.rs/)
|
||||||
|
* [pug](https://pugjs.org/)
|
||||||
|
* [less](http://lesscss.org/)
|
||||||
|
* a bash shell for the build script
|
||||||
|
|
||||||
|
## bugs
|
||||||
|
|
||||||
|
when importing images, some pixels have errors.
|
||||||
|
it seems to only happen for pixels surrounded at the top and left:
|
||||||
|
```
|
||||||
|
111 111
|
||||||
|
100 => 110
|
||||||
|
100 100
|
||||||
|
```
|
||||||
|
|
||||||
|
pixsy does not work in the Itch desktop program
|
||||||
|
because their bundled version of Chromium does not support WebAssembly.
|
||||||
|
|
||||||
|
## to do
|
||||||
|
|
||||||
|
* add alternative dithering options (Atkinson, Bayer 8×8)
|
||||||
|
* add a 'smoothing' (noise reduction?) stage to remove errant pixels
|
||||||
|
|
||||||
|
## could do
|
||||||
|
|
||||||
|
* reimplement tile reuse option
|
||||||
|
* add camera support so users can take a pic instead of uploading an image
|
||||||
|
* allow user to draw to canvas
|
||||||
|
|||||||
6
TODO.md
6
TODO.md
@@ -1,6 +0,0 @@
|
|||||||
# todo
|
|
||||||
|
|
||||||
* tile reuse
|
|
||||||
* noise reduction (remove lonely pixels)
|
|
||||||
* implement Atkinson and Bayer dithering options
|
|
||||||
* fix weird problem with pixels flipping (see test::example)
|
|
||||||
@@ -14,7 +14,7 @@ html(lang="en-gb")
|
|||||||
p.
|
p.
|
||||||
convert images to Bitsy rooms
|
convert images to Bitsy rooms
|
||||||
|
|
|
|
||||||
#[a(href="./old/") old version]
|
#[a(href="http://tinybird.info/image-to-bitsy/old/" target="_blank") old version]
|
||||||
|
|
|
|
||||||
#[a(href="mailto:max@tinybird.info") email]
|
#[a(href="mailto:max@tinybird.info") email]
|
||||||
|
|
|
|
||||||
@@ -78,6 +78,11 @@ html(lang="en-gb")
|
|||||||
| dither
|
| dither
|
||||||
br
|
br
|
||||||
|
|
||||||
|
label
|
||||||
|
input#filter(type="checkbox")
|
||||||
|
| filter
|
||||||
|
br
|
||||||
|
|
||||||
button.pagination.prev#back-to-image previous
|
button.pagination.prev#back-to-image previous
|
||||||
button.pagination.next#room-next add room
|
button.pagination.next#room-next add room
|
||||||
.page.download
|
.page.download
|
||||||
|
|||||||
@@ -8,14 +8,11 @@ import init, {
|
|||||||
output,
|
output,
|
||||||
set_brightness,
|
set_brightness,
|
||||||
set_dither,
|
set_dither,
|
||||||
|
set_filter,
|
||||||
set_palette,
|
set_palette,
|
||||||
set_room_name,
|
set_room_name,
|
||||||
} from './pkg/pixsy.js';
|
} from './pkg/pixsy.js';
|
||||||
|
|
||||||
if (typeof WebAssembly !== "object") {
|
|
||||||
window.location = "./old/"
|
|
||||||
}
|
|
||||||
|
|
||||||
// stolen from https://ourcodeworld.com/articles/read/189/how-to-create-a-file-and-generate-a-download-with-javascript-in-the-browser-without-a-server
|
// stolen from https://ourcodeworld.com/articles/read/189/how-to-create-a-file-and-generate-a-download-with-javascript-in-the-browser-without-a-server
|
||||||
function download(filename, text) {
|
function download(filename, text) {
|
||||||
let element = document.createElement('a');
|
let element = document.createElement('a');
|
||||||
@@ -60,6 +57,10 @@ function readFile(input, callback, type = "text") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
|
if (typeof WebAssembly !== "object") {
|
||||||
|
window.location = "http://tinybird.info/image-to-bitsy/old/"
|
||||||
|
}
|
||||||
|
|
||||||
await init();
|
await init();
|
||||||
|
|
||||||
const buttonAddImage = el("add");
|
const buttonAddImage = el("add");
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ struct State {
|
|||||||
room_name: Option<String>,
|
room_name: Option<String>,
|
||||||
palette: SelectedPalette,
|
palette: SelectedPalette,
|
||||||
dither: bool,
|
dither: bool,
|
||||||
|
filter: bool,
|
||||||
brightness: i32,
|
brightness: i32,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -44,6 +45,7 @@ lazy_static! {
|
|||||||
room_name: None,
|
room_name: None,
|
||||||
palette: SelectedPalette::None,
|
palette: SelectedPalette::None,
|
||||||
dither: true,
|
dither: true,
|
||||||
|
filter: false,
|
||||||
brightness: 0,
|
brightness: 0,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@@ -131,6 +133,12 @@ pub fn set_dither(dither: bool) {
|
|||||||
state.dither = dither;
|
state.dither = dither;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[wasm_bindgen]
|
||||||
|
pub fn set_filter(filter: bool) {
|
||||||
|
let mut state = STATE.lock().unwrap();
|
||||||
|
state.filter = filter;
|
||||||
|
}
|
||||||
|
|
||||||
#[wasm_bindgen]
|
#[wasm_bindgen]
|
||||||
pub fn set_palette(palette_id: &str, background: String, foreground: String) {
|
pub fn set_palette(palette_id: &str, background: String, foreground: String) {
|
||||||
let mut state = STATE.lock().unwrap();
|
let mut state = STATE.lock().unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user