Timeline for XOR two monochrome images
Current License: CC BY-SA 3.0
15 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 23, 2017 at 20:21 | comment | added | ckjbgames | That feeling you get when you golf in a verbose language | |
Jan 17, 2017 at 3:21 | comment | added | anon |
I'm not convinced that you need the throws Exception on main . Then again, I haven't done Java in a while.
|
|
Jan 17, 2017 at 0:44 | comment | added | Tatarize | Bunch of tricks to save 1 character, that coulda been more than saved by y[0] or any of the rest. import static javax.imageio.ImageIO.*;import java.io.*;class Main{public static void main(String[]y)throws Exception{java.awt.image.BufferedImage a=read(new File(y[0])),b=read(new File(y[1]));for(int i=0,q=a.getWidth();i<q*a.getHeight();)a.setRGB(i%q,i/q,a.getRGB(i%q,i/q)^b.getRGB(i%q,i++/q));write(a,"jpg",new File(y[2]));}} | |
Jan 16, 2017 at 23:02 | comment | added | Tatarize | Also, this fails. It tamples with alpha. Needs to save to something without alpha. | |
Jan 16, 2017 at 22:40 | comment | added | Tatarize | for (j=0;j++<a.getWidth();a.setRGB(j, i, a.getRGB(j, i) ^ read(new File(y[1])).getRGB(j, i))) write(a, "png", new File(y[2])); -- Feels wrong, but you can move the command of the second loop into the for's terminator section and then just save every single iteration of the loop, thereby getting rid of one semicolon. | |
Jan 16, 2017 at 22:24 | comment | added | Tatarize | "Input can be taken as a path to the image" -- I gotta note y[0] (4 bytes) is fewer bytes than "a.png" (6 bytes) | |
Jan 16, 2017 at 22:16 | comment | added | Tatarize | You can save a byte by doing ..."i++ < a.getHeight();)" | |
Jan 16, 2017 at 9:25 | comment | added | Huntro |
The file extension .png shouldn't be necessary
|
|
Jan 16, 2017 at 8:06 | history | edited | Marv | CC BY-SA 3.0 |
added 7 characters in body
|
Jan 16, 2017 at 6:35 | comment | added | user41805 |
You can remove the public from public class M to save 7 bytes
|
|
Jan 15, 2017 at 23:15 | history | edited | Marv | CC BY-SA 3.0 |
added 17 characters in body
|
Jan 15, 2017 at 23:14 | comment | added | Marv | Oh dang you're right. Haven't been golfing much lately, totally overlooked that one. Cheers. | |
Jan 15, 2017 at 22:55 | comment | added | hyperneutrino♦ |
You can save a byte by removing the space between String[] y . Just a minor little golf.
|
|
Jan 15, 2017 at 20:12 | history | edited | Dada | CC BY-SA 3.0 |
It looks much better with syntax highlighting
|
Jan 15, 2017 at 19:59 | history | answered | Marv | CC BY-SA 3.0 |