PNG encoder in pure Python.
| 354 | |
| 355 | |
| 356 | class Writer: |
| 357 | """ |
| 358 | PNG encoder in pure Python. |
| 359 | """ |
| 360 | |
| 361 | def __init__( |
| 362 | self, |
| 363 | width=None, |
| 364 | height=None, |
| 365 | size=None, |
| 366 | greyscale=Default, |
| 367 | alpha=False, |
| 368 | bitdepth=8, |
| 369 | palette=None, |
| 370 | transparent=None, |
| 371 | background=None, |
| 372 | gamma=None, |
| 373 | compression=None, |
| 374 | interlace=False, |
| 375 | planes=None, |
| 376 | colormap=None, |
| 377 | maxval=None, |
| 378 | chunk_limit=2**20, |
| 379 | x_pixels_per_unit=None, |
| 380 | y_pixels_per_unit=None, |
| 381 | unit_is_meter=False, |
| 382 | ): |
| 383 | """ |
| 384 | Create a PNG encoder object. |
| 385 | |
| 386 | Arguments: |
| 387 | |
| 388 | width, height |
| 389 | Image size in pixels, as two separate arguments. |
| 390 | size |
| 391 | Image size (w,h) in pixels, as single argument. |
| 392 | greyscale |
| 393 | Pixels are greyscale, not RGB. |
| 394 | alpha |
| 395 | Input data has alpha channel (RGBA or LA). |
| 396 | bitdepth |
| 397 | Bit depth: from 1 to 16 (for each channel). |
| 398 | palette |
| 399 | Create a palette for a colour mapped image (colour type 3). |
| 400 | transparent |
| 401 | Specify a transparent colour (create a ``tRNS`` chunk). |
| 402 | background |
| 403 | Specify a default background colour (create a ``bKGD`` chunk). |
| 404 | gamma |
| 405 | Specify a gamma value (create a ``gAMA`` chunk). |
| 406 | compression |
| 407 | zlib compression level: 0 (none) to 9 (more compressed); |
| 408 | default: -1 or None. |
| 409 | interlace |
| 410 | Create an interlaced image. |
| 411 | chunk_limit |
| 412 | Write multiple ``IDAT`` chunks to save memory. |
| 413 | x_pixels_per_unit |
no outgoing calls
no test coverage detected