Code Monkey home page Code Monkey logo

pixelsort-go's Introduction

pixelsorter (+ cli) written in golang
used my (node)js implementation as reference, which uses satyarth/pixelsort as reference
not at parity; no sorter/comparator validation, patterns/intervals/comparators arent listed in help
furst time using go, might be cursed

features

  • row and spiral patterns
  • sorth with a mask
  • sort multiple images at once
  • sort by lightness, hue, saturation, and r/g/b
  • shuffle pixels, sort in waves, randomly, or do a row sort
  • sort in reverse
  • rotation

wanted features

  • would like to mix and match thresholds (sort by red with saturation threshold, or sort by sat with darkness threshold)
  • more patterns; seam carving looks cool

examples

Original
webb picture-of-the-month 2023/10 - src: ESA/Webb, NASA & CSA, A. Adamo (Stockholm University) and the FEAST JWST team

Mask
mask

Random sort
pixelsort_go --input ~/Downloads/potm2310a.jpg --upper_threshold 0.4 --lower_threshold 0.2 --comparator saturation --angle 30 --randomness 0.4 --interval randomnoisy --output ./examples/webb-sort.jpg randomsort

Basic row sort w/ default options & mask
pixelsort_go --input ~/Downloads/potm2310a.jpg --mask ./examples/webb-mask.jpg --output ./examples/webb-sort.jpg masked row sort

Spiral sort using most options & mask
pixelsort_go --input ~/Downloads/potm2310a.jpg --mask ./examples/webb-mask.jpg --pattern spiral --interval wave --randomness 0.4 --comparator saturation --section_length 400 --output ./examples/webb-spiral.jpg masked spiral sort
did you know webb and hubble pics are cc4?

"elapsed" is time spent actually sorting

=> time pixelsort_go -i ~/Downloads/potm2310a.jpg -o ./benchmark
Sorting 1 images with a config of {Pattern:row Interval:row Comparator:lightness SectionLength:60 Randomness:1 Reverse:false Thresholds:{Lower:0 Upper:1} Angle:0}.
Loading image 1 ("/home/______/Downloads/potm2310a.jpg" -> "./benchmark")...
./benchmark Elapsed: 2.084s
0:02.85 real 2.80 usermode 99% 92852 Kb mem

=> time pixelsort_go -i ~/Downloads/potm2310a.jpg -m ./examples/webb-mask.jpg -o ./benchmark
Sorting 1 images with a config of {Pattern:row Interval:row Comparator:lightness SectionLength:60 Randomness:1 Reverse:false Thresholds:{Lower:0 Upper:1} Angle:0}.
Loading image 1 ("/home/ging/Downloads/potm2310a.jpg" -> "./benchmark")...
./benchmark Elapsed: 1.137s
0:02.42 real 2.32 usermode 98% 218388 Kb mem

pixelsort-go's People

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.