Lines Matching refs:pixels
109 Consider an image that is 3 pixels wide by 2 pixels high, and each pixel
117 Each row appears as its own list, but the pixels are flattened so that
142 In all cases the top row comes first, and for each row the pixels are
152 bit depth is less than 8, several pixels are packed into each byte;
247 Return an array of pixels consisting of the `ipsize` elements of data
343 Image size in pixels, as two separate arguments.
345 Image size (w,h) in pixels, as single argument.
367 The image size (in pixels) can be specified either by using the
425 this will not change the values of the pixels as they appear in
439 affect how the pixels should be presented to the encoder, rather
822 def write_array(self, outfile, pixels):
829 self.write_passes(outfile, self.array_scanlines_interlace(pixels))
831 self.write_passes(outfile, self.array_scanlines(pixels))
861 pixels = array('B')
862 pixels.fromfile(infile,
865 self.write_passes(outfile, self.array_scanlines_interlace(pixels))
874 pixels = array('B')
875 pixels.fromfile(ppmfile,
882 pixels = interleave_planes(pixels, apixels,
886 self.write_passes(outfile, self.array_scanlines_interlace(pixels))
888 self.write_passes(outfile, self.array_scanlines(pixels))
895 pixel. The number of pixels to read is taken from the image
916 def array_scanlines(self, pixels):
918 Generates boxed rows (flat pixels) from flat rows (flat pixels)
928 yield pixels[start:stop]
930 def array_scanlines_interlace(self, pixels):
932 Generator for interlaced scanlines from an array. `pixels` is
946 # Pixels per row (of reduced image)
953 yield pixels[offset:offset+vpr]
957 row.extend(pixels[0:row_len])
963 pixels[offset+i:end_offset:skip]
1076 ``png.from_array(pixels, 'L').save('foo.png')``.
1089 16 pixels high and 8 wide will use an array that is 16x8x3. For 2
1091 is ``width*channels``, so an RGB image that is 16 pixels high and 8
1271 You can create an :class:`Image` object from an array of pixels by calling
1581 # Pixels per row (reduced pass image)
1869 `pixels`, `metadata`).
1873 `pixels` are returned in boxed row flat pixel format.
1922 pixels = itertools.imap(lambda *row: array(arraycode, row),
1925 pixels = self.iterboxed(self.iterstraight(raw))
1936 return self.width, self.height, pixels, meta
1942 Returns (*width*, *height*, *pixels*, *metadata*).
1946 `pixels` are returned in flat row flat pixel format.
1948 See also the :meth:`read` method which returns pixels in the
1993 (*width*, *height*, *pixels*, *meta*)
1998 the result pixels; pixel values will be reduced according to
2012 *pixels* is the pixel data in boxed row flat pixel format (just
2024 x,y,pixels,meta = self.read()
2032 def iterpal(pixels):
2033 for row in pixels:
2036 pixels = iterpal(pixels)
2050 def itertrns(pixels):
2051 for row in pixels:
2052 # For each row we group it into pixels, then form a
2063 pixels = itertrns(pixels)
2078 def itershift(pixels):
2079 for row in pixels:
2081 pixels = itershift(pixels)
2082 return x,y,pixels,meta
2085 """Return image pixels as per :meth:`asDirect` method, but scale
2090 x,y,pixels,info = self.asDirect()
2096 for row in pixels:
2103 width,height,pixels,meta = get()
2109 for row in pixels:
2112 return width, height, pixels, meta
2117 """Return the image data as an RGB pixels with 8-bits per
2128 (*width*, *height*, *pixels*, *metadata*).
2131 *pixels* is the pixel data in boxed row flat pixel format.
2137 """Return the image data as RGBA pixels with 8-bits per
2139 :meth:`asRGBA`: The result pixels have an alpha channel, *and*
2147 """Return image as RGB pixels. RGB colour images are passed
2155 except that the *metadata* reflect the returned pixels, not the
2160 width,height,pixels,meta = self.asDirect()
2164 return width,height,pixels,meta
2168 for row in pixels:
2176 """Return image as RGBA pixels. Greyscales are expanded into
2179 except that the *metadata* reflect the returned pixels, not the
2185 width,height,pixels,meta = self.asDirect()
2187 return width,height,pixels,meta
2197 for row in pixels:
2207 for row in pixels:
2215 for row in pixels:
2520 x,y,pixels,meta = r.read()
2523 self.assertEqual(list(itertools.chain(*pixels)),
2535 x,y,pixels,meta = r.asRGB8()
2538 for i,row in enumerate(pixels):
2550 x,y,pixels,meta = r.asRGB8()
2553 self.assertEqual(map(list, pixels), map(list, [a, b, b, c]))
2565 x,y,pixels
2573 self.assertEqual(map(list, pixels), map(list, flat))
2578 x,y,pixels,meta = r.asRGBA8()
2579 # Test the pixels at row 9 columns 0 and 1.
2580 row9 = list(pixels)[9]
2587 x,y,pixels,meta = r.asRGBA()
2588 row9 = list(list(pixels)[9])
2595 x,y,pixels,meta = r.asRGBA8()
2598 row0 = list(pixels)[0]
2604 images from the pair produce the same array of pixels."""
2614 # Just compare the pixels. Ignore x,y (because they're
2633 x,y,pixels,meta = it.read()
2634 pngi = topngbytes('adam7wn'+name+'.png', pixels,
2641 x,y,pixels,meta = it.read()
2642 pngs = topngbytes('adam7wi'+name+'.png', pixels,
2661 x,y,pixels,meta = r.read()
2671 # The pixels in flat row flat pixel format
2680 x,y,pixels,meta = r.read()
2683 self.assertEqual(list(itertools.chain(*pixels)), flat)
2693 x,y,pixels,info = r.read()
2701 x,y,pixels,info = r.read()
2704 w.write(o, pixels)
2714 x,y,pixels,info = r.read()
2715 pixels = [list(row) for row in pixels]
2719 w.write(o, pixels)
2724 # Same pixels
2726 self.assertEqual(again_pixels, pixels)
2751 pixels = zip([0x00, 0x38, 0x4c, 0x54, 0x5c, 0x40, 0x38, 0x00])
2754 w.write_packed(o, pixels)
2756 x,y,pixels,meta = r.asDirect()
2777 x,y,pixels,info = r.asDirect()
2778 pixels = list(pixels)
2779 self.assertEqual(len(pixels), 2)
2780 self.assertEqual(len(pixels[0]), 16)
2807 """Test file that contains too many pixels."""
2923 pixels = numpy.array([[0,0x5555],[0x5555,0xaaaa]], numpy.uint16)
2924 img = from_array(pixels, 'L')
3601 `width` and `height` are in pixels. `depth` is the number of
3677 def write_pnm(file, width, height, pixels, meta):
3685 # Can be an assert as long as we assume that pixels and meta came
3717 for row in pixels:
3805 width,height,pixels,meta = png.asDirect()
3806 write_pnm(outfile, width, height, pixels, meta)