Python Imaging Library(ImagePath Module)














































Python Imaging Library(ImagePath Module)



ImagePath Module The ImagePath module is used to store and manipulate 2-dimensional vector data. Path objects can be passed to the methods on the ImageDraw module. class PIL.ImagePath.Path A path object. The coordinate list can be any sequence object containing either 2-tuples [(x, y),....] or numeric values [x, y,...]. You can also create a path object from another path object. In 1.1.6 and later, you can also pass in any object that implements Python's buffer API. The buffer should provide read access, and contain C floats in machine byte order. The path object implements most parts of the Python sequence interface, and behaves like a list of (x, y) pairs. You can use len(), item access, and slicing as usual. However, the current version does not support slice assignment, or item and slice deletion. Parameters: xy -: A sequence. The sequence can contain 2-tuples [(x, y),..] or a flat list of numbers [x, y,...]. 1.PIL.ImagePath.Path.compact(distance=2) Compacts the path, by removing points that are close to each other. This method modifies the path in place, and returns the number of points left in the path. distance is measured as Manhattan distance and defaults to two pixels. 2.PIL.ImagePath.Path.getbbox() Gets the bounding box of the path. Returns:(x0, y0, x1, y1) 3.PIL.ImagePath.Path.map(function) Maps the path through a function. 4.PIL.ImagePath.Path.tolist(flat=0) Converts the path to a Python list [(x, y),...]. Parameters: flat - By default, this function returns a list of 2-tuples [(x, y),...]. If this argument is True, it returns a flat list [x, y,...] instead. Returns:A list of coordinates. 5.PIL.ImagePath.Path.transform(matrix) Transforms the path in place, using an affine transform. The matrix is a 6-tuple (a, b, c, d, e, f), and each point is mapped as follows: xOut = xIn * a + yIn * b + c yOut = xIn * d + yIn * e + f

More Articles of Saurabh Sisodia:

Name Views Likes
Python Imaging Library(ExifTags Module) 413 13
Python Imaging Library(ImageTk Module) 579 20
Python Imaging Library(ImageStat Module) 560 29
Python Imaging Library(ImageSequence Module) 428 25
Python Imaging Library(ImagePath Module) 467 28
Python Imaging Library(ImageMath Module) 326 20
Python Imaging Library(ImageFont Module) 616 27
Python Imaging Library(ImageFilter Module) 472 21
Python Imaging Library(ImageFile Module) 323 11
Python Imaging Library(ImageEnhance Module) 364 12
Python program to check if a binary tree is subtree of another binary tree 598 14
Python Imaging Library(ImageDraw Module) 442 22
Python Imaging Library(ImageColor Module) 358 17
Python Imaging Library(Image Module) 404 20
Introduction Of Python Imaging Library (Pillow) 452 25
Python program to reverse a path in binary search tree using queue 423 19
Python program to find the maximum sum leaf to root path in a binary tree 434 27
Python program to find sum of all the numbers that are formed from root to leaf paths 315 11
Python program to find sum of leaf nodes at minimum level 344 16
Python program to print the path common to the two paths from the root to the two given nodes 390 20
Python program to find if there is a triplet in a Balanced binary search tree that adds to zero 466 14
Python program to find longest path with same values in a binary tree 385 14
Python program to find longest consecutive sequence in binary tree 448 27
Python program to find number of turns to reach from one node to other in binary tree 373 25
Python program to find the closest leaf in a binary tree 450 22
Python Program to find the closest leaf node to a given node 392 16
Python program to count pairs from two binary search trees whose sum is equal to a given value x 347 24
Python program to find pairs with given sum such that pair elements lie in different binary search trees 369 22
Python program to check whether a binary tree is a full binary tree or not without using recursion 283 15
Python program to find difference between sums of odd level and even level nodes of a binary tree 331 17
Python program to print duplicate elements from the binary search tree 337 15
Python program to print middle level of perfect binary tree without finding height 381 20
Python program to print path from root to a given node in a binary tree 857 23
Python program to find distance between two given keys of a binary tree 326 15
Python program to find distance from root to given node in a binary tree 320 15
Python program to check if given sorted sub-sequence exists in binary search tree 257 11
Python program to find kth ancestor of a node in binary tree 339 20
Python program to print ancestors of a given node in binary tree 430 22
Python program to find sum of value in each level of binary tree 386 16
Python program to check if a binary tree is sorted level-wise or not 328 14
Python program to get level of a node in binary tree using recursion 362 15
Python program to find successor for a given key in binary search tree without recursion 330 13
Python program to find k-th smallest element in binary search tree 353 24
Python program to convert binary tree to binary search tree 352 16
Python program to check if a binary tree has duplicate values 688 24

Comments