Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #------------------------------------------------------------
- # To encrypt and store a file as a lossless PNG
- #
- # $ cat fileto.store | ./tocolor.sh imagefilename.png columnsize
- #
- # You will be prompted for your encryption key/passphrase
- #
- # You can pipe pretty much anything into it
- # so output from tar, echo, etc will all work too.
- # See updated version here: http://pastebin.com/nPU1sqsb
- #------------------------------------------------------------
- counter=0
- rowcounter=0
- if [ ! -n "$2" ]; then
- echo "Setting Column Size to 500"
- columnsize=500
- else
- echo "Setting Column Size to $2"
- columnsize=$2
- fi
- collimit=$(($columnsize-1))
- ccrypt -e | codegroup | tr '\n' ' '| (
- # while loop
- while IFS= read -r -n1 c
- do
- if [ $counter -gt $collimit ]; then
- counter=0
- let rowcounter+=1
- fi
- case "$c" in
- A) echo -e -n "$counter,$rowcounter: ( 0, 0, 1) #000001 srgb(0,0,1)\n" ;;
- B) echo -e -n "$counter,$rowcounter: ( 0, 0, 2) #000002 srgb(0,0,2)\n" ;;
- C) echo -e -n "$counter,$rowcounter: ( 0, 0, 3) #000003 srgb(0,0,3)\n" ;;
- D) echo -e -n "$counter,$rowcounter: ( 0, 0, 4) #000004 srgb(0,0,4)\n" ;;
- E) echo -e -n "$counter,$rowcounter: ( 0, 0, 5) #000005 srgb(0,0,5)\n" ;;
- F) echo -e -n "$counter,$rowcounter: ( 0, 0, 6) #000006 srgb(0,0,6)\n" ;;
- G) echo -e -n "$counter,$rowcounter: ( 0, 0, 7) #000007 srgb(0,0,7)\n" ;;
- H) echo -e -n "$counter,$rowcounter: ( 0, 0, 8) #000008 srgb(0,0,8)\n" ;;
- I) echo -e -n "$counter,$rowcounter: ( 0, 0, 9) #000009 srgb(0,0,9)\n" ;;
- J) echo -e -n "$counter,$rowcounter: ( 0, 0, 16) #000010 srgb(0,0,16)\n" ;;
- K) echo -e -n "$counter,$rowcounter: ( 0, 0, 17) #000011 srgb(0,0,17)\n" ;;
- L) echo -e -n "$counter,$rowcounter: ( 0, 0, 18) #000012 srgb(0,0,18)\n" ;;
- M) echo -e -n "$counter,$rowcounter: ( 0, 0, 19) #000013 srgb(0,0,19)\n" ;;
- N) echo -e -n "$counter,$rowcounter: ( 0, 0, 20) #000014 srgb(0,0,20)\n" ;;
- O) echo -e -n "$counter,$rowcounter: ( 0, 0, 21) #000015 srgb(0,0,21)\n" ;;
- P) echo -e -n "$counter,$rowcounter: ( 0, 0, 22) #000016 srgb(0,0,22)\n" ;;
- Q) echo -e -n "$counter,$rowcounter: ( 0, 0, 23) #000017 srgb(0,0,23)\n" ;;
- R) echo -e -n "$counter,$rowcounter: ( 0, 0, 24) #000018 srgb(0,0,24)\n" ;;
- S) echo -e -n "$counter,$rowcounter: ( 0, 0, 25) #000019 srgb(0,0,25)\n" ;;
- T) echo -e -n "$counter,$rowcounter: ( 0, 0, 32) #000020 srgb(0,0,32)\n" ;;
- U) echo -e -n "$counter,$rowcounter: ( 0, 0, 33) #000021 srgb(0,0,33)\n" ;;
- V) echo -e -n "$counter,$rowcounter: ( 0, 0, 34) #000022 srgb(0,0,34)\n" ;;
- W) echo -e -n "$counter,$rowcounter: ( 0, 0, 35) #000023 srgb(0,0,35)\n" ;;
- X) echo -e -n "$counter,$rowcounter: ( 0, 0, 36) #000024 srgb(0,0,36)\n" ;;
- Y) echo -e -n "$counter,$rowcounter: ( 0, 0, 37) #000025 srgb(0,0,37)\n" ;;
- Z) echo -e -n "$counter,$rowcounter: ( 0, 0, 38) #000026 srgb(0,0,38)\n" ;;
- " ") echo -e -n "$counter,$rowcounter: ( 0, 0, 39) #000027 srgb(0,0,39)\n" ;;
- esac
- let counter+=1
- done
- let rowcounter+=1
- echo "# ImageMagick pixel enumeration: $columnsize,$rowcounter,255,srgb"
- echo -e -n $color
- ) |sed '1h;1d;$!H;$!d;G' | convert -monitor txt: "$1"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement