7
\$\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\$
2
  • \$\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, 2016 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\$ Jun 6, 2016 at 8:39

1 Answer 1

11
\$\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\$
6
  • 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, 2016 at 19:15
  • 1
    \$\begingroup\$ Another image format that is very easy to write to: BMP. \$\endgroup\$
    – user42643
    Jun 5, 2016 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\$ Jun 6, 2016 at 15:38
  • \$\begingroup\$ @mınxomaτ Unfortunately, that's proprietary. \$\endgroup\$
    – wizzwizz4
    Jun 11, 2016 at 19:11
  • \$\begingroup\$ @ThomasWeller brainfuck has an input operator. \$\endgroup\$
    – hobbs
    Jun 13, 2016 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\$ Jun 15, 2016 at 9:43

You must log in to answer this question.

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