Skip to content

0xf0xx0/pixelsort-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pixelsort_go

pixelsorter cli written in golang

rewritten from my nodejs implementation, which used satyarth/pixelsort as reference

furst time using go, might be cursed

features

  • row, spiral, and seam carving patterns
  • shuffle pixels, sort in waves, random lengths, or smear instead
  • sort by lightness, hue, saturation, and r/g/b
  • sort with a mask
  • sort images in parallel
  • sort in reverse
  • rotation

wanted features

  • even more patterns
  • completion? im lazy

install

from source

git clone https://github.com/0xf0xx0/pixelsort-go.git
cd pixelsort-go
go build
# now move the binary, or
go install
# to install to your GOBIN/GOPATH

examples/usage

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

Mask b&w mask

Row sort w/ default options pixelsort_go --input ~/Downloads/potm2310a.jpg --output ./examples/webb-row.jpg row sort

Row sort w/ threshold pixelsort_go --input ~/Downloads/potm2310a.jpg --lower_threshold 0.3 --upper_threshold 0.6 --output ./examples/webb-row-thresh.jpg row sort

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

Spiral sort w/ default options pixelsort_go --input ~/Downloads/potm2310a.jpg --pattern spiral --output ./examples/webb-spiral.jpg spiral 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-masked.jpg masked spiral sort

Seam sort w/ default options pixelsort_go --input ~/Downloads/potm2310a.jpg --pattern seam --output ./examples/webb-seam.jpg seam sort

Seam sort w/ default options & mask pixelsort_go --input ~/Downloads/potm2310a.jpg --mask ./examples/webb-mask.jpg --pattern seam --output ./examples/webb-seam-masked.jpg masked seam sort

did you know webb and hubble pics are cc4?

"benchmark"

"elapsed" is time spent actually sorting
src img is the "large jpg" dl from esawebb.org

=> time pixelsort_go -i ~/Downloads/potm2310a.jpg -o ./benchmark
Sorting 1 images with a config of {Pattern:row Interval:row Comparator:lightness SectionLength:69 Randomness:1 Reverse:false Thresholds:{Lower:0 Upper:1} Angle:0}.
Loading image 1 (/home/________/Downloads/potm2310a.jpg -> ./benchmark)...
Sorting /home/________/Downloads/potm2310a.jpg...
./benchmark elapsed: 2.112s
Writing ./benchmark...
0:02.78 real 2.72 usermode 99% 85124 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:69 Randomness:1 Reverse:false Thresholds:{Lower:0 Upper:1} Angle:0}.
Loading image 1 (/home/________/Downloads/potm2310a.jpg -> ./benchmark)...
Sorting /home/________/Downloads/potm2310a.jpg...
./benchmark elapsed: 1.287s
Writing ./benchmark...
0:02.11 real 2.05 usermode 99% 89884 Kb mem