Steganographic Squares Steganographic Squares
Your job is to take in a string, and generate an NxN image that represents this string. You must also write the algorithm that takes in the image and turns it back into a string as well. The scoring will be will include the byte count of both algorithms:
&quot;Encryption&quot; Algorithm + &quot;Decryption&quot; Algorithm.
You should post each separately, with byte-counts for both the encryption and decryption algorithms displayed individually.

Example Algorithm
For instance, here's the &quot;Programming Puzzles and Code Golf&quot; using a simple ASCII based steganographic algorithm in the Blue channel:
#2e7250,#6ea972,#04eb6f,#0fc767,#74ab72,#ee6161
#b73b6d,#1aae6d,#f37169,#bda56e,#1fe367,#e99620
#706450,#0d3575,#146b7a,#4ea47a,#2a856c,#95d065
#3f2d73,#cef720,#bab661,#d1b86e,#f22564,#12b820
#0f3d43,#c86e6f,#1ee864,#a66565,#247c20,#c3bb47
#0e296f,#89d46c,#585b66,#c08f20,#455c20,#136f20

Actual Image (  )

You can see the blue channel simply holds the ascii values for this image:
50 =  80(P) 72 = 114(r) 6f = 111(o) 67 = 103(g) 72 = 114(r) 61 =  97(a) 
6d = 109(m) 6d = 109(m) 69 = 105(i) 6e = 110(n) 67 = 103(g) 20 =  32( ) 
50 =  80(P) 75 = 117(u) 7a = 122(z) 7a = 122(z) 6c = 108(l) 65 = 101(e) 
73 = 115(s) 20 =  32( ) 61 =  97(a) 6e = 110(n) 64 = 100(d) 20 =  32( ) 
43 =  67(C) 6f = 111(o) 64 = 100(d) 65 = 101(e) 20 =  32( ) 47 =  71(G) 
6f = 111(o) 6c = 108(l) 66 = 102(f) 20 =  32( ) 20 =  32( ) 20 =  32( )

While the rest of the channels hold randomly generated values to &quot;spice up&quot; the variety of colors in the image. When pulling the message back out of the image, we can just simply ignore the other channel values, and pull the hex bit in the blue channel, reconstructing the string:
&quot;Programming Puzzles and Code Golf&quot;

Notice the spaces that were used to pad the string in the square are not included in the final decrypted output. While you must pad the string in the image, you may assume that the input string will not end with spaces.

Rules

You must encode 1 character per pixel, the channel chosen to encode the char is arbitrary.
The channels of the other RGB colors must be randomized, other than the one you're choosing to encode the string into; this means your final non-encoded channels would need to be between 0x0000-0xFFFF (randomly chosen).
Expressing the final result as a 2D array of RGB color values is fine 0x000000-0xFFFFFF, no need to use image creation unless you want to have fun with it or if it's less bytes. If you choose to output as hex strings, prefix the hex string with # E.G. #FFFFFF or #05AB1E. You may separate with tabs, commas, or anything else that would be horizontally sensible, but it must maintain the square pattern; in other words, you must use appropriate newline separation.
The output must be in a square, and the string must be padded with spaces at the end to accomodate this. This means that N≈SQRT(Input#Length()). If the input length is not a perfect square, you should round up on N and pad with spaces.
As stated previously, if you are padding with spaces in the image, you must not include the padded characters in the final &quot;decrypted&quot; output.
You can assume that:

The input string will not end with spaces.
The input string will only use printable ASCII characters.


This is code-golf, lowest byte count wins.
C, 201 (Encoding) + 175 (Decoding) = 376 bytes
To Encode:
E(char*J){size_t L=ceil(sqrt(strlen(J)));int U;srand(time(NULL));for(int i=0;i&lt;L;i++){for(int f=0;f&lt;L;f++){printf(&quot;#%02X%02X%02X &quot;,rand()%256,(U&lt;strlen(J))?(int)J[U]:32,rand()%256);U+=1;}printf(&quot;\n&quot;);}}

Encodes each character of the input string in the green channel of the RGB spectrum while setting the two other channels as random hex values. Takes input through STDIN as a string and outputs to STDOUT a multiline string of hex color code in the shape of a square. Assuming you have Python 3 and ImageMagick installed, and the above file is compiled into a file named a.out in the current working directory (CWD), you can directly get the resulting image, named Output.png, to the CWD from the textual output using the following command:
./a.out &quot;&lt;Multiline Input&gt;&quot;|python3 -c &quot;import sys,subprocess;Input=sys.stdin.read();print('# ImageMagick pixel enumeration: {0},{0},255,rgb\n'.format(len(Input.split('\n')[1].split()))+'\n'.join(['%d,%d:(%d,%d,%d)'%(g,i,int(j[1:][:2],16),int(j[1:][2:4],16),int(j[1:][4:6],16))for g,h in enumerate(Input.split('\n'))for i,j in enumerate(h.split())]))&quot;|convert - -scale 1000% Output.png

Here is a sample output image created by the above commamd using Programming Puzzles and Code Golf as the input string:

To Decode:
D(int c,char**U){char T[c];for(int Y=1;Y&lt;c;Y++){char G[2]={U[Y][3],U[Y][4]};T[Y-1]=(char)strtol(G,NULL,16);}int C=c-1;T[C]='\0';while(T[C]==' '){T[C]='\0';C-=1;}printf(&quot;%s\n&quot;,T);}

Takes input through STDIN a sequence of space-separated hex color code strings with each one enclosed in double quotes (&quot;) (char** argv in main) and also, when called in main, int argc for the integer input. Outputs to STDOUT a single/multi-line string representing the decoded message.
I will try to golf these more over time whenever and wherever I can.

Also, if you same both of the methods into the same file, you can use the following main method to put it all together with each function getting the correct inputs:
int main(int argc,char**argv){if(strcmp(argv[1],&quot;E&quot;)==0){Encode(argv[2]);}else{Decode(argc,argv);}}

and using this, for encoding you must provide E as the first argument to call the encoding method followed by the single string argument, whereas for decoding, all you need to provide is the sequence of space-separated hex color code strings with each one enclosed in double-quotes (&quot;).

Finally, if you want, you can get the fully prepared, ready-to-use version here, although it is not golfed, but also does not output any warnings or errors upon compilation.