9
The Problem:
This challenge comes from a real problem I was having. I have a dual monitor setup at work, and I wanted to use the following image as my wallpaper:
However, my monitors have quite significant bezels, and when I set my background, it looks something like this, where the pier appears (appiers?) to be broken:
I was able to solve this by making an image with the center cut out of it, and then stretching it back to the original size, as in the image below:
The Challenge:
Write a program that takes in an image and "monitorizes" it for use with a dual monitor setup (i.e. deletes the center section of the image, where the bezels are). The rules are as follows:
- It must be a full program that accepts the image, either as a path (string argument, etc), or in the form of a file chooser dialog.
- The program must take as an input the number of vertical lines (one pixel in width) to crop out from the center of the image
- The cropping must come from the center (width-wise) of the original image
- The resultant image must be re-scaled back to the original size of the input image. (Either the halves can be scaled individually, and then concatenated, or concatenated and then scaled. Scaling individually produces a better image/effect, but is hardly noticeable in the real world)
- Background images are generally even, so to make this challenge easier, input images will only have an even number of pixels, and number of lines to remove will only be even as well.
- This challenge is code golf - shortest code in bytes wins
Good Luck!
2>
@PeterTaylor As per rule 3, the input and output images are supposed to be the same width. Either each half is resized to half the original width, and then concatenated, or the cropped halves are concatenated, then scaled back to the original size. And yes, any scaling is fine. – dberm22 – 2017-04-06T20:49:05.287
The sentence beginning "Perhaps" was a suggestion for how to make the question easier to understand, not a suggested interpretation of the challenge. I've made the change myself. – Peter Taylor – 2017-04-06T22:51:23.070
@PeterTaylor Ahh, i see, That makes it clearer. Thanks. – dberm22 – 2017-04-07T11:45:14.227
Can we assume that the image will be landscape oriented? – Scott Milner – 2017-04-07T18:54:05.630
@ScottMilner Yes – dberm22 – 2017-04-07T22:50:58.457
-1 bad puns (just kidding, I upvoted :P Nice challenge!) – HyperNeutrino – 2017-04-08T02:47:24.420