15
2
Create program or function that takes file name as an argument or reads it from standard input, and completes the following task:
- Read image from a png file (name given as argument).
- Reverse colors in that image, so that for example dark green (0, 75, 30) would become (255, 180, 225) (because 255-0=255, 255-75=180 and 255-30=225). You should not change alpha channel value.
- Output that image to a file called
a.png
(in png format), or show it in GUI window.
This is code-golf. Standard loopholes apply.
Is it required to support any optional png features? Are built-in png loading/writing functions acceptable? – Sparr – 2016-03-28T22:42:14.330
@Sparr Optional feature support is optional. Built-in functions are not explicitly disallowed, so I'll assume they are allowed. – Hannes Karppila – 2016-03-28T22:44:51.970
5
PNG files can be indexed (each pixel contains a pointer to a color in the colormap) or truecolor (each pixel contains the actual color). Which one do we need to support? Can we choose? In fact, there are five different subformats regarding color. So... ?
– Luis Mendo – 2016-03-28T23:20:11.100@DonMuesli I think any method that provides correct result will be fine. You can assume that the color isn't greyscale, and supporting alpha-channel is optional. I think that using any other mode is acceptable, as long as the task will still be reversing the colors, and colors have (r,g,b)-values. – Hannes Karppila – 2016-03-29T09:10:06.047
1Can I use just CSS? – Rizze – 2016-09-08T08:36:38.353