Out Steganograph Me!

5

3

Out Steganograph Me

As a follow up to this challange, I want to see competitive algorithms for encoding strings as images, and then decoding them.

The Challenge

Your goal is to write a function or program that when given a string as an input, outputs an image. Then, in a seprate program/function, accept that same image as input, and output the string first given.

This should work with any arbitrary string, assuming it is in your chosen character encoding.

You may take input as an array of characters or bytes if it makes it easier, and you may output as a three dimensional array of bytes, or a two dimensional array of hex strings, instead of an image, as well.

Scoring

This is , your score will be based on your average score across the test cases.

Individual test cases are scored by taking which of the two dimensions are larger of the output Image, Width or Height, to encourage square instead of lines or rectnagles.

eg, a 5x8 image has a score of 8. A 9x9 has a score of 9, and a 1x30 image has a score of 30.

Lowest Score Wins!

Example for Clarity

A basic algorithm which assigns each UTF-8 Character to each of the RGB channels of an image. so H becomes the r of the first pixel, e becomes the g and so on.

  1. Score 3

Actual:3x3

Expanded:3x3

  1. Score 6

Actual:6x6

Expanded:6x6

  1. Score 4

Actual:4x4

Expanded:4x4

  1. Score 1

Actual:1x1

Expanded:1x1

Average = (3+6+4+1)/4 = 4.6666667

Test Cases

  • Hello, World!
  • This was a triumph. I'm making a note here, HUGE SUCCESS! It's hard to overstate my satisfaction.
  • Multiline Strings Usually Cause Problems
  • !

Rules

  • Standard IO Rules Apply
  • Standard Loopholes Apply
  • You may use any form of Character Encoding for your String Input/Output, however, it must support the entire visible range of Ascii, and your programs must support the entirety of it. EG. UTF-8 Must support and such.
  • Control Characters that do not effect the visible output of your string, eg. NUL will not appear in your input.
  • Predefined Compression or Decompression functions are forbidden, as it defeats the Porpoise of the challenge.
  • Trailing characters after the decoded output are acceptable, although discouraged.
  • Have Fun!

ATaco

Posted 2016-11-14T01:57:24.997

Reputation: 7 898

Question was closed 2016-11-14T09:27:25.800

2Really, portal reference? :P +1 for the porpoise :) – HyperNeutrino – 2016-11-14T02:16:34.463

For those not getting the reference – JungHwan Min – 2016-11-14T02:43:49.250

1As far as I can tell it's a simple base-conversion task, so [tag:code-challenge] doesn't seem to be appropriate. – feersum – 2016-11-14T03:41:58.787

Not necessarily, It's a compression task. Trying to fit as much data in an image as possible. – ATaco – 2016-11-14T03:46:08.383

Any specific file format? – Conor O'Brien – 2016-11-14T04:19:18.310

Nope, as long as you can get the data back out of it. So probably not Jpeg. – ATaco – 2016-11-14T05:02:42.410

Can we have trailing spaces? – dkudriavtsev – 2016-11-14T05:47:37.913

@wat Allowed 'em. – ATaco – 2016-11-14T06:02:22.830

1If you want to write a challenge about making the best file compression, you should do that straightforwardly, without a pointless image-based output format. And to create a challenge about compression requires vastly more test data and information about what type of input the program should perform well on. – feersum – 2016-11-14T06:22:56.613

Does the second program only need to decrypt the files created by the first one? Counter example: I write one image with the first program, open it in an image processing program, save it (unmodified) and the second program cannot read it any more because the image processing program uses a slightly different file header/trailer/compression method/... – Martin Rosenau – 2016-11-14T06:26:09.680

Dividing by three and taking a square root is trivial compared to the real challenge here, so this doesn't add anything worthwhile to existing general (i.e. not image, music , etc.) compression questions. – Peter Taylor – 2016-11-14T07:54:26.287

Is the color depth limited? I could search for an image format allowing arbitrary color depths and encode the whole sentence into a color! Then I could encode any sentence into an 1-pixel-image. – Martin Rosenau – 2016-11-14T16:08:22.950

Umm. This is NOT a duplicate of the compression challenge. It requires other methods of compression – dkudriavtsev – 2016-11-15T04:11:26.353

It is about encoding into an image, not just compressing – dkudriavtsev – 2016-11-15T04:11:42.807

With credit to those who've marked it, it is essentially just a Do X but Y problem. However, the people may find it interesting enough to reopen. – ATaco – 2016-11-15T04:20:29.900

Steganography has nothing to do with compression and decompression - it's about hiding the data cleverly. This challenge is about choosing an image format that allows the fewest number of pixels - not the smallest number of bytes. @MartinRosenau has the right idea - a one pixel image would win regardless of the size of the image file. I don't think this is a duplicate of a compression/decompression question. – Jerry Jeremiah – 2017-04-06T02:36:20.950

No answers