« first day (2851 days earlier)      last day (2112 days later) » 
01:00 - 22:0022:00 - 00:00

10:14 PM
this is odd. it looks a lot closer to correct now, but there's still something wrong
it's saying -1 in 2's complement is 01111111, not 11111111.
the output of invert() is correct as far as i can tell, so it must be something with how 1 is added...
 
10:31 PM
@heather That code looks a little odd. I'm not exactly sure what you're trying to do there, but it looks more complicated than it probably needs to be. Do you really need a string of eight zero & one characters as the output? Can't you just send a single byte with the correct bit pattern to those pins?
Maybe I didn't read your code properly, repl.it isn't easy to read on a phone. And I'm on the verge of falling asleep. :)
 
10:45 PM
@PM2Ring well what i'm doing with it from there is taking each bit in the string using a for loop and then outputting it to the pin using RPi.GPIO.
so it probably is more complicated than it needs to be; it was just the first solution that came to mind.
 
cbg
Can anyone suggest a way of converting an 24-bit colour (format: (0-255, 0-255, 0-255)) to an 8-bit colour with the same format?
Figured it out:
 
11:01 PM
@Mr.Zeus What do you mean by "the same format"? Can you give an example of input and output?
 
blue = 245//8*8
green = 134//8*8
red = 157//8*8
They will all be rounded to the closest 8-bit equivalent, right?
In [5]: _24bit = (245, 134, 157)

In [6]: _8bit = []

In [7]: for i in range(len(_24bit)):
   ...:     _8bit.append(_24bit[i]//8*8)
   ...:

In [8]: _8bit
Out[8]: [240, 128, 152]
Though, 255 converts to 248, hmmmm
 
What do you mean by "8-bit color"?
 
Color depth or colour depth (see spelling differences), also known as bit depth, is either the number of bits used to indicate the color of a single pixel, in a bitmapped image or video frame buffer, or the number of bits used for each color component of a single pixel. For consumer video standards, such as High Efficiency Video Coding (H.265), the bit depth specifies the number of bits used for each color component. When referring to a pixel, the concept can be defined as bits per pixel (bpp), which specifies the number of bits used. When referring to a color component, the concept can be defined...
 
I am aware of the concept of color depth, and I have seen the wiki article on 8-bit color. That still doesn't tell us what you mean.
Are you using a palette? Do you want to allocate a specific number of bits to each color channel?
Currently, you seem to be compressing each color channel to 5 bits per pixel.
 
11:23 PM
Sorry, I'm trying to convert a 24-bit to a standard 8-bit palette.
Sorry that took so long. Life, am I right?
I am trying to convert each 24-bit pixel of an image into an 8-bit pixel, then doing a bunch of other things to the 8-bit pixel.
I just made that more confusing, I fixed my problem.
That's all that matters
I take that back, but I think I can figure it out, rbrb
 
01:00 - 22:0022:00 - 00:00

« first day (2851 days earlier)      last day (2112 days later) »