Timeline for "Add one" to every color in an image
Current License: CC BY-SA 3.0
22 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 2, 2016 at 9:36 | comment | added | dieter |
golfing your solution a bit further, I have 216 bytes : from PIL import Image R,m=range,Image.open(input()).convert("RGB") L=m.load() W,H=m.size def X(*p):t=L[p];h=t[0]+(t[1]<<8)+(t[2]<<16)+1118481;L[p]=h&255,h>>8&255,h>>16&255 [X(x,y)for x in R(W)for y in R(H)] m.show()
|
|
Jun 21, 2016 at 18:38 | history | edited | mbomb007 | CC BY-SA 3.0 |
edited body
|
Jun 21, 2016 at 18:37 | history | edited | TuxCrafting | CC BY-SA 3.0 |
deleted 2 characters in body
|
Jun 21, 2016 at 18:34 | comment | added | mbomb007 | And some spaces can become tabs. See this tip. | |
Jun 21, 2016 at 18:30 | history | edited | TuxCrafting | CC BY-SA 3.0 |
added 32 characters in body
|
Jun 21, 2016 at 18:29 | comment | added | TuxCrafting | @mbomb007 Thanks you | |
Jun 21, 2016 at 18:23 | comment | added | mbomb007 |
You can combine 2 lines with m.putpixel((x,y),(h&255,h>>8&255,h>>16&255)) , and 0x111111 can become 1118481 .
|
|
Jun 21, 2016 at 18:10 | comment | added | Yytsi |
No problem! It doesn't work since open is an built in function in Python so it meets a collision when importing everything from PIL :(
|
|
Jun 21, 2016 at 18:04 | comment | added | TuxCrafting |
@TuukkaX Thanks you ! Oh and from PIL import* don't work :c
|
|
Jun 21, 2016 at 18:04 | history | edited | TuxCrafting | CC BY-SA 3.0 |
deleted 1 character in body
|
Jun 21, 2016 at 17:41 | comment | added | Yytsi |
Also, you can save 2 bytes by removing the outer parentheses when you're defining the variable h .
|
|
Jun 21, 2016 at 17:37 | comment | added | Yytsi |
Oh okay. I'm pretty sure that (h>>8)&255 can be changed to h>>8&255 and (h>>16)&255 to h>>16&255 .
|
|
Jun 21, 2016 at 17:23 | history | edited | TuxCrafting | CC BY-SA 3.0 |
deleted 5 characters in body
|
Jun 21, 2016 at 17:23 | comment | added | TuxCrafting |
@TuukkaX Yes, it can be changed to from PIL import* , but i can't change the Image.open
|
|
Jun 21, 2016 at 17:00 | comment | added | Yytsi |
I think you can save more bytes by saying from PIL import* . I also think that Image.open can be changed to just open after that.
|
|
Jun 21, 2016 at 7:17 | history | edited | TuxCrafting | CC BY-SA 3.0 |
deleted 1 character in body
|
Jun 21, 2016 at 7:12 | comment | added | Yytsi |
There is one more 0xFF in there :D
|
|
Jun 21, 2016 at 7:10 | history | edited | TuxCrafting | CC BY-SA 3.0 |
deleted 2 characters in body; added 41 characters in body
|
Jun 21, 2016 at 7:10 | comment | added | TuxCrafting | @TuukkaX Woops i haven't noticed that thanks you | |
Jun 20, 2016 at 23:23 | comment | added | Yytsi |
Is it necessary to use 0xFF instead of 255 ?
|
|
Jun 19, 2016 at 16:39 | history | edited | TuxCrafting | CC BY-SA 3.0 |
added 55 characters in body
|
Jun 19, 2016 at 16:18 | history | answered | TuxCrafting | CC BY-SA 3.0 |