mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
More PyQt6 nonsense
SIP can apparently no longer auto-convert QVector<Rgb>
This commit is contained in:
parent
9957480ddb
commit
053fd6f5bf
@ -73,10 +73,12 @@ QImage oil_paint(const QImage &image, const float radius=-1, const bool high_qua
|
||||
sipRes = new QImage(oil_paint(*a0, a1, a2));
|
||||
IMAGEOPS_SUFFIX
|
||||
%End
|
||||
QImage quantize(const QImage &image, unsigned int maximum_colors, bool dither, const QVector<QRgb> &palette);
|
||||
QImage quantize(const QImage &image, unsigned int maximum_colors, bool dither, SIP_PYTUPLE);
|
||||
%MethodCode
|
||||
QVector<QRgb> palette(PyTuple_GET_SIZE(a3));
|
||||
for (int i = 0; i < PyTuple_GET_SIZE(a3); i++) palette[i] = PyLong_AsUnsignedLong(PyTuple_GET_ITEM(a3, i));
|
||||
IMAGEOPS_PREFIX
|
||||
sipRes = new QImage(quantize(*a0, a1, a2, *a3));
|
||||
sipRes = new QImage(quantize(*a0, a1, a2, palette));
|
||||
IMAGEOPS_SUFFIX
|
||||
%End
|
||||
|
||||
|
@ -503,7 +503,7 @@ def quantize_image(img, max_colors=256, dither=True, palette=''):
|
||||
img = blend_image(img)
|
||||
if palette and isinstance(palette, string_or_bytes):
|
||||
palette = palette.split()
|
||||
return imageops.quantize(img, max_colors, dither, [QColor(x).rgb() for x in palette])
|
||||
return imageops.quantize(img, int(max_colors), dither, tuple(QColor(x).rgb() for x in palette))
|
||||
|
||||
|
||||
def eink_dither_image(img):
|
||||
|
Loading…
x
Reference in New Issue
Block a user