2009-11-16 14 views
23

के दस्तावेज़ और उदाहरण PythonMagick के दस्तावेज़ और उदाहरण कहां मिल सकते हैं?पायथन मैगिक

मैंने Google पर एक खोज की लेकिन कोई भी जानकारी नहीं मिली।

+2

जैक क्या आप इस पर स्वीकृत उत्तर बदल सकते हैं? – Natim

उत्तर

-11

यह MagickWand API करने के लिए एक बाइंडिंग है: http://www.assembla.com/wiki/show/pythonmagickwand

तो तुम MagickWand एपीआई कार्यों के सभी का उपयोग कर सकते हैं।

#!/usr/bin/python 
import Magick 

# Use the Python Imaging Library to create a Tk display 
dpy = Magick.TkDisplay(startmain=0) 

# Read the image 
img = Magick.read('test.gif') 

# Display the image 
dpy(img) 
dpy(img.Swirl(90)) 

dpy.startmain=1 
dpy.show() 
+26

मुझे नहीं पता कि यह क्यों स्वीकार किया गया है, यह सही नहीं है। * दो अलग पायथन-छवि मैगिक एपीआई * हैं। ओपी एक (PythonMagick) के बारे में पूछ रहा है, और आप दूसरे (PythonMagickWand) के बारे में जानकारी के साथ जवाब दे रहे हैं। –

+0

हां मेरा बुरा, मैं या तो नहीं जानता। – Natim

31

मैं उन्हें कहीं भी नहीं ढूंढ पाया लेकिन इस तरह मैं इसे किसी भी तरह से उपयोग करने के लिए चला गया।

उदाहरण

import PythonMagick 
image = PythonMagick.Image("sample_image.jpg") 
print image.fileName() 
print image.magick() 
print image.size().width() 
print image.size().height() 
उत्पादन के साथ

इस

sample_image.jpg 
JPEG 
345 
229 

की तरह पता लगाने के लिए छवि तरीकों उदाहरण मैं सीपीपी स्रोत में देखा के लिए उपलब्ध हैं। लेना छवि ऑब्जेक्ट बाइंडिंग: _Image.cpp में लागू छवि या इस पृष्ठ पर Klaus द्वारा किसी अन्य उत्तर में शामिल विधियों को प्राप्त करने के सुझाव को बेहतर तरीके से देखें।

इस फाइल में आप इस

.def("contrast", &Magick::Image::contrast) 
    .def("convolve", &Magick::Image::convolve) 
    .def("crop", &Magick::Image::crop) 
    .def("cycleColormap", &Magick::Image::cycleColormap) 
    .def("despeckle", &Magick::Image::despeckle) 

उद्धरण में बिट छवि वस्तु के समारोह नाम के नक्शे की तरह रेखाएं दिखाई देंगी। इस दृष्टिकोण के बाद आप उपयोगी होने के लिए पर्याप्त जानकारी प्राप्त कर सकते हैं। उदाहरण के लिए ज्यामिति विशिष्ट विधियों _Geometry.cpp में हैं और The

 .def("width", (size_t (Magick::Geometry::*)() const)&Magick::Geometry::width) 
    .def("height", (void (Magick::Geometry::*)(size_t))&Magick::Geometry::height) 
    .def("height", (size_t (Magick::Geometry::*)() const)&Magick::Geometry::height) 
    .def("xOff", (void (Magick::Geometry::*)(ssize_t))&Magick::Geometry::xOff) 
    .def("xOff", (ssize_t (Magick::Geometry::*)() const)&Magick::Geometry::xOff) 
17

की तरह सामान्य संदिग्धों में शामिल हैं पता लगाने के लिए तरीकों अजगर में टाइप करें:

import PythonMagick 
dir(PythonMagick.Image()) 

तो फिर तुम जैसे एक आउटपुट प्राप्त इस:

['__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__instance_size__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'adaptiveThreshold', 'addNoise', 'adjoin', 'affineTransform', 'animationDelay', 'animationIterations', 'annotate', 'antiAlias', 'attribute', 'backgroundColor', 'backgroundTexture', 'baseColumns', 'baseFilename', 'baseRows', 'blur', 'border', 'borderColor', 'boundingBox', 'boxColor', 'cacheThreshold', 'channel', 'channelDepth', 'charcoal', 'chop', 'chromaBluePrimary', 'chromaGreenPrimary', 'chromaRedPrimary', 'chromaWhitePoint', 'classType', 'clipMask', 'colorFuzz', 'colorMap', 'colorMapSize', 'colorSpace', 'colorize', 'columns', 'comment', 'compare', 'compose', 'composite', 'compressType', 'contrast', 'convolve', 'crop', 'cycleColormap', 'debug', 'defineSet', 'defineValue', 'density', 'depth', 'despeckle', 'directory', 'display', 'draw', 'edge', 'emboss', 'endian', 'enhance', 'equalize', 'erase', 'fileName', 'fileSize', 'fillColor', 'fillPattern', 'fillRule', 'filterType', 'flip', 'floodFillColor', 'floodFillOpacity', 'floodFillTexture', 'flop', 'font', 'fontPointsize', 'fontTypeMetrics', 'format', 'frame', 'gamma', 'gaussianBlur', 'geometry', 'gifDisposeMethod', 'iccColorProfile', 'implode', 'interlaceType', 'iptcProfile', 'isValid', 'label', 'lineWidth', 'magick', 'magnify', 'map', 'matte', 'matteColor', 'matteFloodfill', 'meanErrorPerPixel', 'medianFilter', 'minify', 'modifyImage', 'modulate', 'modulusDepth', 'monochrome', 'montageGeometry', 'negate', 'normalize', 'normalizedMaxError', 'normalizedMeanError', 'oilPaint', 'opacity', 'opaque', 'page', 'penColor', 'penTexture', 'ping', 'pixelColor', 'process', 'profile', 'quality', 'quantize', 'quantizeColorSpace', 'quantizeColors', 'quantizeDither', 'quantizeTreeDepth', 'raise', 'read', 'readPixels', 'reduceNoise', 'registerId', 'renderingIntent', 'resolutionUnits', 'roll', 'rotate', 'rows', 'sample', 'scale', 'scene', 'segment', 'shade', 'sharpen', 'shave', 'shear', 'signature', 'size', 'solarize', 'spread', 'statistics', 'stegano', 'stereo', 'strokeAntiAlias', 'strokeColor', 'strokeDashOffset', 'strokeLineCap', 'strokeLineJoin', 'strokeMiterLimit', 'strokePattern', 'strokeWidth', 'subImage', 'subRange', 'swirl', 'syncPixels', 'textEncoding', 'texture', 'threshold', 'throwImageException', 'tileName', 'totalColors', 'transform', 'transformOrigin', 'transformReset', 'transformRotation', 'transformScale', 'transformSkewX', 'transformSkewY', 'transparent', 'trim', 'type', 'unregisterId', 'unsharpmask', 'verbose', 'view', 'wave', 'write', 'writePixels', 'x11Display', 'xResolution', 'yResolution', 'zoom']

16

जो मैं कह सकता हूं, से PythonMagick Magick++ library लपेटता है। मैं इस लाइब्रेरी का उपयोग पाइथन में सी ++ कोड कॉपी और पेस्ट करने में सक्षम हूं और यह अपेक्षा के अनुसार काम करता है। इसके अलावा कक्षाओं और सदस्य कार्यों के नाम मिलते हैं (जहां मैजिकवैंड पूरी तरह अलग दिखता है)।

import PythonMagick as Magick 
    img = Magick.Image("testIn.jpg") 
    img.quality(100) #full compression 
    img.magick('PNG') 
    img.write("testOut.png") 
0

किसी को भी, जो अभी भी PythonMagick के प्रलेखन खोजने की कोशिश कर रहा है के लिए, PythonMagick बिल्कुल Magick के रूप में ही (सी के लिए एपीआई ++) ++ है। here मैजिक ++ दस्तावेज है। कुछ विशिष्ट पैरामीटर के लिए, आपको उस प्रकार को फिर से गणना करना होगा (उदा। गुरुत्वाकर्षण-> पायथन मैगिक। ग्रेविटी टाइप .hegravityyouwant)

संबंधित मुद्दे