mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update ImageMagick compiling and constants
This commit is contained in:
parent
0cd7b5f46f
commit
e80ce3f6d6
@ -111,7 +111,8 @@ extensions = [
|
|||||||
headers=['calibre/utils/magick/magick_constants.h'],
|
headers=['calibre/utils/magick/magick_constants.h'],
|
||||||
libraries=magick_libs,
|
libraries=magick_libs,
|
||||||
lib_dirs=magick_lib_dirs,
|
lib_dirs=magick_lib_dirs,
|
||||||
inc_dirs=magick_inc_dirs
|
inc_dirs=magick_inc_dirs,
|
||||||
|
cflags=['-DMAGICKCORE_QUANTUM_DEPTH=16', '-DMAGICKCORE_HDRI_ENABLE=0']
|
||||||
),
|
),
|
||||||
|
|
||||||
Extension('lzx',
|
Extension('lzx',
|
||||||
|
@ -7,7 +7,7 @@ __docformat__ = 'restructuredtext en'
|
|||||||
|
|
||||||
import os, textwrap, re, subprocess
|
import os, textwrap, re, subprocess
|
||||||
|
|
||||||
INC = '/usr/include/ImageMagick'
|
INC = '/usr/include/ImageMagick-6'
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Various constants defined in the ImageMagick header files. Note that
|
Various constants defined in the ImageMagick header files. Note that
|
||||||
@ -33,6 +33,8 @@ def parse_enums(f):
|
|||||||
|
|
||||||
def get_value(const):
|
def get_value(const):
|
||||||
t = '''
|
t = '''
|
||||||
|
#define MAGICKCORE_QUANTUM_DEPTH 16
|
||||||
|
#define MAGICKCORE_HDRI_ENABLE 0
|
||||||
#include <wand/MagickWand.h>
|
#include <wand/MagickWand.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
@ -42,7 +44,7 @@ def get_value(const):
|
|||||||
'''%const
|
'''%const
|
||||||
with open('/tmp/ig.c','wb') as f:
|
with open('/tmp/ig.c','wb') as f:
|
||||||
f.write(t)
|
f.write(t)
|
||||||
subprocess.check_call(['gcc', '-I/usr/include/ImageMagick', '/tmp/ig.c', '-o', '/tmp/ig', '-lMagickWand'])
|
subprocess.check_call(['gcc', '-I'+INC, '/tmp/ig.c', '-o', '/tmp/ig', '-lMagickWand-6.Q16'])
|
||||||
return int(subprocess.Popen(["/tmp/ig"],
|
return int(subprocess.Popen(["/tmp/ig"],
|
||||||
stdout=subprocess.PIPE).communicate()[0].strip())
|
stdout=subprocess.PIPE).communicate()[0].strip())
|
||||||
|
|
||||||
@ -50,7 +52,7 @@ def get_value(const):
|
|||||||
def main():
|
def main():
|
||||||
constants = []
|
constants = []
|
||||||
for x in ('resample', 'image', 'draw', 'distort', 'composite', 'geometry',
|
for x in ('resample', 'image', 'draw', 'distort', 'composite', 'geometry',
|
||||||
'colorspace', 'compare'):
|
'colorspace', 'compare', 'compress'):
|
||||||
constants += list(parse_enums('magick/%s.h'%x))
|
constants += list(parse_enums('magick/%s.h'%x))
|
||||||
base = os.path.dirname(__file__)
|
base = os.path.dirname(__file__)
|
||||||
constants = [
|
constants = [
|
||||||
|
@ -31,7 +31,8 @@ static void magick_add_module_constants(PyObject *m) {
|
|||||||
PyModule_AddIntConstant(m, "RobidouxSharpFilter", 27);
|
PyModule_AddIntConstant(m, "RobidouxSharpFilter", 27);
|
||||||
PyModule_AddIntConstant(m, "CosineFilter", 28);
|
PyModule_AddIntConstant(m, "CosineFilter", 28);
|
||||||
PyModule_AddIntConstant(m, "SplineFilter", 29);
|
PyModule_AddIntConstant(m, "SplineFilter", 29);
|
||||||
PyModule_AddIntConstant(m, "SentinelFilter", 30);
|
PyModule_AddIntConstant(m, "LanczosRadiusFilter", 30);
|
||||||
|
PyModule_AddIntConstant(m, "SentinelFilter", 31);
|
||||||
PyModule_AddIntConstant(m, "UndefinedAlphaChannel", 0);
|
PyModule_AddIntConstant(m, "UndefinedAlphaChannel", 0);
|
||||||
PyModule_AddIntConstant(m, "ActivateAlphaChannel", 1);
|
PyModule_AddIntConstant(m, "ActivateAlphaChannel", 1);
|
||||||
PyModule_AddIntConstant(m, "BackgroundAlphaChannel", 2);
|
PyModule_AddIntConstant(m, "BackgroundAlphaChannel", 2);
|
||||||
@ -300,6 +301,13 @@ static void magick_add_module_constants(PyObject *m) {
|
|||||||
PyModule_AddIntConstant(m, "HCLColorspace", 24);
|
PyModule_AddIntConstant(m, "HCLColorspace", 24);
|
||||||
PyModule_AddIntConstant(m, "LCHColorspace", 25);
|
PyModule_AddIntConstant(m, "LCHColorspace", 25);
|
||||||
PyModule_AddIntConstant(m, "LMSColorspace", 26);
|
PyModule_AddIntConstant(m, "LMSColorspace", 26);
|
||||||
|
PyModule_AddIntConstant(m, "LCHabColorspace", 27);
|
||||||
|
PyModule_AddIntConstant(m, "LCHuvColorspace", 28);
|
||||||
|
PyModule_AddIntConstant(m, "scRGBColorspace", 29);
|
||||||
|
PyModule_AddIntConstant(m, "HSIColorspace", 30);
|
||||||
|
PyModule_AddIntConstant(m, "HSVColorspace", 31);
|
||||||
|
PyModule_AddIntConstant(m, "HCLpColorspace", 32);
|
||||||
|
PyModule_AddIntConstant(m, "YDbDrColorspace", 33);
|
||||||
PyModule_AddIntConstant(m, "UndefinedMetric", 0);
|
PyModule_AddIntConstant(m, "UndefinedMetric", 0);
|
||||||
PyModule_AddIntConstant(m, "AbsoluteErrorMetric", 1);
|
PyModule_AddIntConstant(m, "AbsoluteErrorMetric", 1);
|
||||||
PyModule_AddIntConstant(m, "MeanAbsoluteErrorMetric", 2);
|
PyModule_AddIntConstant(m, "MeanAbsoluteErrorMetric", 2);
|
||||||
@ -310,4 +318,27 @@ static void magick_add_module_constants(PyObject *m) {
|
|||||||
PyModule_AddIntConstant(m, "RootMeanSquaredErrorMetric", 7);
|
PyModule_AddIntConstant(m, "RootMeanSquaredErrorMetric", 7);
|
||||||
PyModule_AddIntConstant(m, "NormalizedCrossCorrelationErrorMetric", 8);
|
PyModule_AddIntConstant(m, "NormalizedCrossCorrelationErrorMetric", 8);
|
||||||
PyModule_AddIntConstant(m, "FuzzErrorMetric", 9);
|
PyModule_AddIntConstant(m, "FuzzErrorMetric", 9);
|
||||||
|
PyModule_AddIntConstant(m, "UndefinedErrorMetric", 0);
|
||||||
|
PyModule_AddIntConstant(m, "UndefinedCompression", 0);
|
||||||
|
PyModule_AddIntConstant(m, "NoCompression", 1);
|
||||||
|
PyModule_AddIntConstant(m, "BZipCompression", 2);
|
||||||
|
PyModule_AddIntConstant(m, "DXT1Compression", 3);
|
||||||
|
PyModule_AddIntConstant(m, "DXT3Compression", 4);
|
||||||
|
PyModule_AddIntConstant(m, "DXT5Compression", 5);
|
||||||
|
PyModule_AddIntConstant(m, "FaxCompression", 6);
|
||||||
|
PyModule_AddIntConstant(m, "Group4Compression", 7);
|
||||||
|
PyModule_AddIntConstant(m, "JPEGCompression", 8);
|
||||||
|
PyModule_AddIntConstant(m, "JPEG2000Compression", 9);
|
||||||
|
PyModule_AddIntConstant(m, "LosslessJPEGCompression", 10);
|
||||||
|
PyModule_AddIntConstant(m, "LZWCompression", 11);
|
||||||
|
PyModule_AddIntConstant(m, "RLECompression", 12);
|
||||||
|
PyModule_AddIntConstant(m, "ZipCompression", 13);
|
||||||
|
PyModule_AddIntConstant(m, "ZipSCompression", 14);
|
||||||
|
PyModule_AddIntConstant(m, "PizCompression", 15);
|
||||||
|
PyModule_AddIntConstant(m, "Pxr24Compression", 16);
|
||||||
|
PyModule_AddIntConstant(m, "B44Compression", 17);
|
||||||
|
PyModule_AddIntConstant(m, "B44ACompression", 18);
|
||||||
|
PyModule_AddIntConstant(m, "LZMACompression", 19);
|
||||||
|
PyModule_AddIntConstant(m, "JBIG1Compression", 20);
|
||||||
|
PyModule_AddIntConstant(m, "JBIG2Compression", 21);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user