« first day (2825 days earlier)      last day (2137 days later) » 
02:00 - 21:0021:00 - 00:00

9:08 PM
@user2357112 I'm not entirely sure that I get what you're saying. Is repl.it different from my comand line repl?
(I can't test it myself, only have windows at home)
 
@Arne: It's different, and it's especially different when you type your code into the left box and hit "Run" instead of typing it into the more REPL-y right box.
 
cbg
 
9:31 PM
Anyone familiar with PIL/Pillow and know how to invert an image mask?
Right now it looks like I have to break the image into RGBA and then invert only the alpha... but I only care about the alpha.
 
one way that surely works but is probably an anti-pattern is converting to an array and inverting in numpy
NB: I use numpy but not PIL
 
@user2357112 Thanks, good to know. I didn't even realise I could type on the right side =0
 
something like img_arr = np.array(img) and then inverted_arr = 1 - img_arr (assuming it's a float between 0 and 1 rather than uint8 values) and finally something like PIL.Image.fromarray(inverted_arr)
@Arne hence "REPL".it ;)
my original also assumed that the mask is greyscale but I hope that's a reasonable assumption for a mask
 
wim
@idjaw mocker fixture can do anything that patch.object can do.
and monkeypatch can do it too, although the interfaces of mocker are often more powerful
 
I figured there was a method, I found it: PIL.ImageChops.invert(fp)
 
wim
9:44 PM
funny module name
Chops = channel operations
but it's also slang for something approximately like "skillz"
 
And for chops as in chopping it to pieces
 
@TemporalWolf Doesn't that invert all channels though?
 
It doesn't appear to: I get a black/transparent where it was transparent/color
I would have assumed the same, but apparently not
I mean, I guess the rest of the channels are swapped, but because it's a mask with 0 or 255 transparency, they get hidden by the transparency
 
that'd explain it
 
@PM2Ring yup, a known issue. I've filed an internal bug report on that already.
 
wim
10:01 PM
faceb0rk
 
 
2 hours later…
11:41 PM
@MoxieBall I mean you may well be right. I thought it was worth figuring out which way we should go on that tag. Several more responses on that meta post would help decide.
@PM2Ring yeah I guess we need to decide whether we tag or ; the former will be Python-centric and prevent discussing algorithms across languages, the latter needs the aforementioned tag cleanup. I just want to facilitate cleaning up the current minor mess...
@MoxieBall Hell no, I never suggested should be for for/foreach-while-loop variable. I only said that that title word/ keyword occurs in those contexts; that's one of the senses of 'counter' on SO.
... so a tag wiki would need to say "Do not use this tag for the for/foreach/while-loop variable, use the corresponding control structure tag"
 
if i have an equation like "plus or minus the sqrt of x" or something like that, how can i go about representing the plus or minus in python?
i saw this, but i'm still rather confused, as the main answer seems to be about tolerancing, not this application.
 
@wim Just trying to clean up the mess. There is still confusion out there, e.g. one very highly-upvoted obsolete answer from ~2011 where they implement a Counter by hand from defaultdict. But if you search today in 2018 that's the #1 answer.
 
02:00 - 21:0021:00 - 00:00

« first day (2825 days earlier)      last day (2137 days later) »