8
\$\begingroup\$

Is participating in image-processing challenges allowed, if the language does not support images? If it is allowed, what shall the input format be?

Related question where this issue came up in the comments.

\$\endgroup\$
  • \$\begingroup\$ It's not the first time this problem arises; I'm shocked to learn that there is no meta post about this. \$\endgroup\$ – Leaky Nun Jun 4 '16 at 16:16
  • \$\begingroup\$ @LeakyNun That's not really the case. There's this which shows some support for allowing matrix input for image processing challenges. \$\endgroup\$ – Martin Ender Jun 6 '16 at 8:39
12
\$\begingroup\$

All languages (which support input via an arbitrary stream of bytes) technically support images. An image file (PNG, JPG, GIF, etc.) can simply be processed without builtin image manipulation functions or image libraries.

However, clearly it is impractical to expect answers to rewrite an implementation of PNG for every challenge. A popular image format that I've used and seen used on PPCG is Netpbm, which is extremely easy to parse; images can be converted to and from .p*m with Imagemagick (convert) or a similar tool.

For challenge-writers: Unless the image format is integral to the challenge (such as Output a solid PNG from scratch), it is strongly recommended that you do not arbitrarily restrict image formats for input and output, so that all languages can reasonably participate.

\$\endgroup\$
  • 3
    \$\begingroup\$ On the same token, do not abuse the format looseness to your advantage. For example, if converting the original image to something lossy, even if common (such as jpeg), would give some sort of advantage (not dealing with the reading/writing, but with the meat of the challenge), I'd consider that foul play. \$\endgroup\$ – Geobits Jun 4 '16 at 19:15
  • 1
    \$\begingroup\$ Another image format that is very easy to write to: BMP. \$\endgroup\$ – mınxomaτ Jun 5 '16 at 2:14
  • \$\begingroup\$ In principle I agree. In practice, how does input in Brainfuck look like? Do we assume it just exists somewhere in memory? \$\endgroup\$ – Thomas Weller Jun 6 '16 at 15:38
  • \$\begingroup\$ @mınxomaτ Unfortunately, that's proprietary. \$\endgroup\$ – wizzwizz4 Jun 11 '16 at 19:11
  • \$\begingroup\$ @ThomasWeller brainfuck has an input operator. \$\endgroup\$ – hobbs Jun 13 '16 at 16:36
  • \$\begingroup\$ I'd go further, and suggest that a good code-golf challenge where the image processing is important, but not the reading or writing, should either permit the use of necessary libraries for I/O or allow the image to be passed as a suitable array of pixels. \$\endgroup\$ – Toby Speight Jun 15 '16 at 9:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .