mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-13 18:11:02 +03:00
dummy method
This commit is contained in:
parent
8a30d13537
commit
335f5431de
1
setup.py
1
setup.py
|
@ -39,6 +39,7 @@ _LIB_IMAGING = (
|
||||||
"Access",
|
"Access",
|
||||||
"AlphaComposite",
|
"AlphaComposite",
|
||||||
"Resample",
|
"Resample",
|
||||||
|
"Reduce",
|
||||||
"Bands",
|
"Bands",
|
||||||
"BcnDecode",
|
"BcnDecode",
|
||||||
"BitDecode",
|
"BitDecode",
|
||||||
|
|
|
@ -1887,6 +1887,22 @@ class Image(object):
|
||||||
|
|
||||||
return self._new(self.im.resize(size, resample, box))
|
return self._new(self.im.resize(size, resample, box))
|
||||||
|
|
||||||
|
def reduce(self, factor):
|
||||||
|
"""
|
||||||
|
Returns reduced in `factor` times copy of the image.
|
||||||
|
If the size of the image is not dividable by the `factor`,
|
||||||
|
the resulting size will be rounded up.
|
||||||
|
|
||||||
|
:param factor: A greater than 0 integer or tuple of two integers
|
||||||
|
for width and height separately.
|
||||||
|
"""
|
||||||
|
if not isinstance(factor, (list, tuple)):
|
||||||
|
factor = (factor, factor)
|
||||||
|
|
||||||
|
self.load()
|
||||||
|
|
||||||
|
return self._new(self.im.reduce(factor))
|
||||||
|
|
||||||
def rotate(
|
def rotate(
|
||||||
self,
|
self,
|
||||||
angle,
|
angle,
|
||||||
|
|
|
@ -1829,6 +1829,28 @@ _resize(ImagingObject* self, PyObject* args)
|
||||||
return PyImagingNew(imOut);
|
return PyImagingNew(imOut);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static PyObject*
|
||||||
|
_reduce(ImagingObject* self, PyObject* args)
|
||||||
|
{
|
||||||
|
Imaging imIn;
|
||||||
|
Imaging imOut;
|
||||||
|
|
||||||
|
int xscale, yscale;
|
||||||
|
|
||||||
|
imIn = self->image;
|
||||||
|
|
||||||
|
if (!PyArg_ParseTuple(args, "(ii)", &xscale, &yscale))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if (xscale < 1 || yscale < 1) {
|
||||||
|
return ImagingError_ValueError("scale must be > 0");
|
||||||
|
}
|
||||||
|
|
||||||
|
imOut = ImagingReduce(imIn, xscale, yscale);
|
||||||
|
|
||||||
|
return PyImagingNew(imOut);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#define IS_RGB(mode)\
|
#define IS_RGB(mode)\
|
||||||
(!strcmp(mode, "RGB") || !strcmp(mode, "RGBA") || !strcmp(mode, "RGBX"))
|
(!strcmp(mode, "RGB") || !strcmp(mode, "RGBA") || !strcmp(mode, "RGBX"))
|
||||||
|
@ -3277,6 +3299,7 @@ static struct PyMethodDef methods[] = {
|
||||||
{"rankfilter", (PyCFunction)_rankfilter, 1},
|
{"rankfilter", (PyCFunction)_rankfilter, 1},
|
||||||
#endif
|
#endif
|
||||||
{"resize", (PyCFunction)_resize, 1},
|
{"resize", (PyCFunction)_resize, 1},
|
||||||
|
{"reduce", (PyCFunction)_reduce, 1},
|
||||||
{"transpose", (PyCFunction)_transpose, 1},
|
{"transpose", (PyCFunction)_transpose, 1},
|
||||||
{"transform2", (PyCFunction)_transform2, 1},
|
{"transform2", (PyCFunction)_transform2, 1},
|
||||||
|
|
||||||
|
|
|
@ -313,6 +313,7 @@ extern Imaging ImagingRotate270(Imaging imOut, Imaging imIn);
|
||||||
extern Imaging ImagingTranspose(Imaging imOut, Imaging imIn);
|
extern Imaging ImagingTranspose(Imaging imOut, Imaging imIn);
|
||||||
extern Imaging ImagingTransverse(Imaging imOut, Imaging imIn);
|
extern Imaging ImagingTransverse(Imaging imOut, Imaging imIn);
|
||||||
extern Imaging ImagingResample(Imaging imIn, int xsize, int ysize, int filter, float box[4]);
|
extern Imaging ImagingResample(Imaging imIn, int xsize, int ysize, int filter, float box[4]);
|
||||||
|
extern Imaging ImagingReduce(Imaging imIn, int xscale, int yscale);
|
||||||
extern Imaging ImagingTransform(
|
extern Imaging ImagingTransform(
|
||||||
Imaging imOut, Imaging imIn, int method, int x0, int y0, int x1, int y1,
|
Imaging imOut, Imaging imIn, int method, int x0, int y0, int x1, int y1,
|
||||||
double *a, int filter, int fill);
|
double *a, int filter, int fill);
|
||||||
|
|
16
src/libImaging/Reduce.c
Normal file
16
src/libImaging/Reduce.c
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
#include "Imaging.h"
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
|
#define ROUND_UP(f) ((int) ((f) >= 0.0 ? (f) + 0.5F : (f) - 0.5F))
|
||||||
|
|
||||||
|
|
||||||
|
Imaging
|
||||||
|
ImagingReduce(Imaging imIn, int xscale, int yscale)
|
||||||
|
{
|
||||||
|
Imaging imOut = NULL;
|
||||||
|
|
||||||
|
imOut = ImagingNewDirty(imIn->mode, imIn->xsize, imIn->ysize);
|
||||||
|
|
||||||
|
return imOut;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user