@@ -83,7 +83,42 @@ static void flush_png_data(png_structp png_ptr)
83
83
Py_XDECREF (result);
84
84
}
85
85
86
- const char *Py_write_png__doc__ = " write_png(buffer, file, dpi=0)" ;
86
+ const char *Py_write_png__doc__ =
87
+ " write_png(buffer, file, dpi=0, compression=6, filter=auto)\n "
88
+ " \n "
89
+ " Parameters\n "
90
+ " ----------\n "
91
+ " buffer : numpy array of image data\n "
92
+ " Must be an MxNxD array of dtype uint8.\n "
93
+ " - if D is 1, the image is greyscale\n "
94
+ " - if D is 3, the image is RGB\n "
95
+ " - if D is 4, the image is RGBA\n "
96
+ " \n "
97
+ " file : str path, file-like object or None\n "
98
+ " - If a str, must be a file path\n "
99
+ " - If a file-like object, must write bytes\n "
100
+ " - If None, a byte string containing the PNG data will be returned\n "
101
+ " \n "
102
+ " dpi : float\n "
103
+ " The dpi to store in the file metadata.\n "
104
+ " \n "
105
+ " compression : int\n "
106
+ " The level of lossless zlib compression to apply. 0 indicates no\n "
107
+ " compression. Values 1-9 indicate low/fast through high/slow\n "
108
+ " compression. Default is 6.\n "
109
+ " \n "
110
+ " filter : int\n "
111
+ " Filter to apply. Must be one of the constants: PNG_FILTER_NONE,\n "
112
+ " PNG_FILTER_SUB, PNG_FILTER_UP, PNG_FILTER_AVG, PNG_FILTER_PAETH.\n "
113
+ " See the PNG standard for more information.\n "
114
+ " If not provided, libpng will try to automatically determine the\n "
115
+ " best filter on a line-by-line basis.\n "
116
+ " \n "
117
+ " Returns\n "
118
+ " -------\n "
119
+ " buffer : bytes or None\n "
120
+ " Byte string containing the PNG content if None was passed in for\n "
121
+ " file, otherwise None is returned.\n " ;
87
122
88
123
static PyObject *Py_write_png (PyObject *self, PyObject *args, PyObject *kwds)
89
124
{
@@ -546,21 +581,46 @@ static PyObject *_read_png(PyObject *filein, bool float_result)
546
581
}
547
582
}
548
583
549
- const char *Py_read_png_float__doc__ = " read_png_float(file)" ;
584
+ const char *Py_read_png_float__doc__ =
585
+ " read_png_float(file)\n "
586
+ " \n "
587
+ " Read in a PNG file, converting values to floating-point doubles\n "
588
+ " in the range (0, 1)\n "
589
+ " \n "
590
+ " Parameters\n "
591
+ " ----------\n "
592
+ " file : str path or file-like object\n " ;
550
593
551
594
static PyObject *Py_read_png_float (PyObject *self, PyObject *args, PyObject *kwds)
552
595
{
553
596
return _read_png (args, true );
554
597
}
555
598
556
- const char *Py_read_png_int__doc__ = " read_png_int(file)" ;
599
+ const char *Py_read_png_int__doc__ =
600
+ " read_png_int(file)\n "
601
+ " \n "
602
+ " Read in a PNG file with original integer values.\n "
603
+ " \n "
604
+ " Parameters\n "
605
+ " ----------\n "
606
+ " file : str path or file-like object\n " ;
557
607
558
608
static PyObject *Py_read_png_int (PyObject *self, PyObject *args, PyObject *kwds)
559
609
{
560
610
return _read_png (args, false );
561
611
}
562
612
563
- const char *Py_read_png__doc__ = " read_png(file)" ;
613
+ const char *Py_read_png__doc__ =
614
+ " read_png(file)\n "
615
+ " \n "
616
+ " Read in a PNG file, converting values to floating-point doubles\n "
617
+ " in the range (0, 1)\n "
618
+ " \n "
619
+ " Alias for read_png_float()\n "
620
+ " \n "
621
+ " Parameters\n "
622
+ " ----------\n "
623
+ " file : str path or file-like object\n " ;
564
624
565
625
static PyMethodDef module_methods[] = {
566
626
{" write_png" , (PyCFunction)Py_write_png, METH_VARARGS|METH_KEYWORDS, Py_write_png__doc__},
0 commit comments