kopia lustrzana https://github.com/pimoroni/pimoroni-pico
adding pngdec
rodzic
8bca73df5d
commit
3aa4f170a8
|
@ -583,3 +583,42 @@ The arguments for `decode` are as follows:
|
|||
2. Decode Y
|
||||
3. Flags - one of `JPEG_SCALE_FULL`, `JPEG_SCALE_HALF`, `JPEG_SCALE_QUARTER` or `JPEG_SCALE_EIGHTH`
|
||||
4. If you want to turn off dither altogether, try `dither=False`. This is useful if you want to [pre-dither your images](https://ditherit.com/) or for artsy posterization effects.
|
||||
|
||||
### PNG Files
|
||||
|
||||
We've included BitBank's PNGDEC - https://github.com/bitbank2/PNGDEC - so you can display PNG files on your LCDs.
|
||||
|
||||
Eg:
|
||||
|
||||
```python
|
||||
import picographics
|
||||
import pngdec
|
||||
|
||||
display = PicoGraphics(display=DISPLAY_PICO_DISPLAY, pen_type=PEN_RGB332)
|
||||
|
||||
# Create a new PNG decoder for our PicoGraphics
|
||||
png = pngdec.PNG(display)
|
||||
|
||||
# Open the PNG file
|
||||
png.open_file("filename.jpeg")
|
||||
|
||||
# Decode the PNG
|
||||
png.decode(0, 0)
|
||||
|
||||
# Display the result
|
||||
display.update()
|
||||
```
|
||||
|
||||
PNG files must be small enough to load into RAM for decoding.
|
||||
|
||||
PNGDEC Supports the following PNG types:
|
||||
|
||||
1. True Colour
|
||||
2. True Colour (with Alpha)
|
||||
3. Indexed
|
||||
4. Grayscale
|
||||
|
||||
The arguments for `decode` are as follows:
|
||||
|
||||
1. Decode X - where to place the decoded JPEG on screen
|
||||
2. Decode Y
|
Ładowanie…
Reference in New Issue