[matplotlib-devel] the 32768 pixel limit
Dear list, I am trying to work with matplotlib to plot on an AGG canvas of size 5x1100. It seems to be the constraint is in AGG. Does anybody has experience in this regard? After removing the exception about the image size and replacing 'int' with long long, figimage correctly puts an image and save to a rgba raw file. There are, however, two problems that I can't solve. 1 when the border rectangle(0,0) - (5, 0) - (5, 1100) - (0, 1100) - (0,0) is rendered, I see the scanlines all end up with a length of 16636(which happens to be 65536 - 5). and nothing is evidently drawn in the final image. 2 when I try to plot a circle at (4, 0). Nothing is shown and no scanline is produced at all. In both situation the vertices are correctly passed to the rasterizer. Is there a version of Agg that can do with larger images? Yu Yu -- vRanger cuts backup time in half-while increasing security. With the market-leading solution for virtual backup and recovery, you get blazing-fast, flexible, and affordable data protection. Download your free trial now. http://p.sf.net/sfu/quest-d2dcopy1 ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
[matplotlib-devel] build matplotlib1.0.1 with libpng.1.5.2
hi list, first, thanks for providing matplotlib, i am using it in several projects. i had problems with several png files and decided to upgrade libpng. this broke matplotlib. as you can see in the documentation of libpng15, it is no longer possible to directly access png_infop. i have created the following patch: --- matplotlib-1.0.1/src/_png.cpp 2010-10-12 16:14:42.0 + +++ matplotlib-1.0.1X/src/_png.cpp 2011-05-25 19:23:36.261752651 + @@ -350,18 +350,21 @@ png_set_sig_bytes(png_ptr, 8); png_read_info(png_ptr, info_ptr); -png_uint_32 width = info_ptr->width; -png_uint_32 height = info_ptr->height; +png_uint_32 width = png_get_image_width(png_ptr, info_ptr); +png_uint_32 height = png_get_image_height(png_ptr, info_ptr); -int bit_depth = info_ptr->bit_depth; +int bit_depth = png_get_bit_depth(png_ptr, info_ptr); // Unpack 1, 2, and 4-bit images if (bit_depth < 8) png_set_packing(png_ptr); +// this is needed several times, so safe it in a variable +png_byte color_type = png_get_color_type(png_ptr, info_ptr); + // If sig bits are set, shift data png_color_8p sig_bit; -if ((info_ptr->color_type != PNG_COLOR_TYPE_PALETTE) && +if ((color_type != PNG_COLOR_TYPE_PALETTE) && png_get_sBIT(png_ptr, info_ptr, &sig_bit)) { png_set_shift(png_ptr, sig_bit); @@ -374,13 +377,13 @@ } // Convert palletes to full RGB -if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) +if (color_type == PNG_COLOR_TYPE_PALETTE) { png_set_palette_to_rgb(png_ptr); } // If there's an alpha channel convert gray to RGB -if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) +if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { png_set_gray_to_rgb(png_ptr); } @@ -408,11 +411,11 @@ npy_intp dimensions[3]; dimensions[0] = height; //numrows dimensions[1] = width; //numcols -if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA) +if (color_type & PNG_COLOR_MASK_ALPHA) { dimensions[2] = 4; //RGBA images } -else if (info_ptr->color_type & PNG_COLOR_MASK_COLOR) +else if (color_type & PNG_COLOR_MASK_COLOR) { dimensions[2] = 3; //RGB images } @@ -421,7 +424,7 @@ dimensions[2] = 1; //Greyscale images } //For gray, return an x by y array, not an x by y by 1 -int num_dims = (info_ptr->color_type & PNG_COLOR_MASK_COLOR) ? 3 : 2; +int num_dims = (color_type & PNG_COLOR_MASK_COLOR) ? 3 : 2; double max_value = (1 << ((bit_depth < 8) ? 8 : bit_depth)) - 1; PyArrayObject *A = (PyArrayObject *) PyArray_SimpleNew( kind regards, dieter -- vRanger cuts backup time in half-while increasing security. With the market-leading solution for virtual backup and recovery, you get blazing-fast, flexible, and affordable data protection. Download your free trial now. http://p.sf.net/sfu/quest-d2dcopy1 ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
[matplotlib-devel] build matplotlib1.0.1 with libpng1.5.2
hi list, first, thanks for providing matplotlib, i am using it in several projects. i had problems with several png files and decided to upgrade libpng. as you can see in the documentation of libpng, direct access to png_infop is no longer possible. i have created the following patch: --- matplotlib-1.0.1/src/_png.cpp 2010-10-12 16:14:42.0 + +++ matplotlib-1.0.1X/src/_png.cpp 2011-05-25 19:23:36.261752651 + @@ -350,18 +350,21 @@ png_set_sig_bytes(png_ptr, 8); png_read_info(png_ptr, info_ptr); -png_uint_32 width = info_ptr->width; -png_uint_32 height = info_ptr->height; +png_uint_32 width = png_get_image_width(png_ptr, info_ptr); +png_uint_32 height = png_get_image_height(png_ptr, info_ptr); -int bit_depth = info_ptr->bit_depth; +int bit_depth = png_get_bit_depth(png_ptr, info_ptr); // Unpack 1, 2, and 4-bit images if (bit_depth < 8) png_set_packing(png_ptr); +// this is needed several times, so safe it in a variable +png_byte color_type = png_get_color_type(png_ptr, info_ptr); + // If sig bits are set, shift data png_color_8p sig_bit; -if ((info_ptr->color_type != PNG_COLOR_TYPE_PALETTE) && +if ((color_type != PNG_COLOR_TYPE_PALETTE) && png_get_sBIT(png_ptr, info_ptr, &sig_bit)) { png_set_shift(png_ptr, sig_bit); @@ -374,13 +377,13 @@ } // Convert palletes to full RGB -if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) +if (color_type == PNG_COLOR_TYPE_PALETTE) { png_set_palette_to_rgb(png_ptr); } // If there's an alpha channel convert gray to RGB -if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) +if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { png_set_gray_to_rgb(png_ptr); } @@ -408,11 +411,11 @@ npy_intp dimensions[3]; dimensions[0] = height; //numrows dimensions[1] = width; //numcols -if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA) +if (color_type & PNG_COLOR_MASK_ALPHA) { dimensions[2] = 4; //RGBA images } -else if (info_ptr->color_type & PNG_COLOR_MASK_COLOR) +else if (color_type & PNG_COLOR_MASK_COLOR) { dimensions[2] = 3; //RGB images } @@ -421,7 +424,7 @@ dimensions[2] = 1; //Greyscale images } //For gray, return an x by y array, not an x by y by 1 -int num_dims = (info_ptr->color_type & PNG_COLOR_MASK_COLOR) ? 3 : 2; +int num_dims = (color_type & PNG_COLOR_MASK_COLOR) ? 3 : 2; double max_value = (1 << ((bit_depth < 8) ? 8 : bit_depth)) - 1; PyArrayObject *A = (PyArrayObject *) PyArray_SimpleNew( kind regards, dieter -- vRanger cuts backup time in half-while increasing security. With the market-leading solution for virtual backup and recovery, you get blazing-fast, flexible, and affordable data protection. Download your free trial now. http://p.sf.net/sfu/quest-d2dcopy1 ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
Re: [matplotlib-devel] build matplotlib1.0.1 with libpng.1.5.2
On 05/25/2011 10:53 AM, Dieter Schön wrote: > hi list, > > first, thanks for providing matplotlib, i am using it in several projects. > > i had problems with several png files and decided to upgrade libpng. > this broke matplotlib. > as you can see in the documentation of libpng15, it is no longer possible > to directly access png_infop. > > i have created the following patch: Dieter, Thank you, but the modification has already been made to the master branch. I did not consider this as a bug fix, so I applied it only to master, not to the maintenance branch. Eric > > --- matplotlib-1.0.1/src/_png.cpp 2010-10-12 16:14:42.0 + > +++ matplotlib-1.0.1X/src/_png.cpp2011-05-25 19:23:36.261752651 + > @@ -350,18 +350,21 @@ > png_set_sig_bytes(png_ptr, 8); > png_read_info(png_ptr, info_ptr); > > -png_uint_32 width = info_ptr->width; > -png_uint_32 height = info_ptr->height; > +png_uint_32 width = png_get_image_width(png_ptr, info_ptr); > +png_uint_32 height = png_get_image_height(png_ptr, info_ptr); > > -int bit_depth = info_ptr->bit_depth; > +int bit_depth = png_get_bit_depth(png_ptr, info_ptr); > > // Unpack 1, 2, and 4-bit images > if (bit_depth< 8) > png_set_packing(png_ptr); > > +// this is needed several times, so safe it in a variable > +png_byte color_type = png_get_color_type(png_ptr, info_ptr); > + > // If sig bits are set, shift data > png_color_8p sig_bit; > -if ((info_ptr->color_type != PNG_COLOR_TYPE_PALETTE)&& > +if ((color_type != PNG_COLOR_TYPE_PALETTE)&& > png_get_sBIT(png_ptr, info_ptr,&sig_bit)) > { > png_set_shift(png_ptr, sig_bit); > @@ -374,13 +377,13 @@ > } > > // Convert palletes to full RGB > -if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) > +if (color_type == PNG_COLOR_TYPE_PALETTE) > { > png_set_palette_to_rgb(png_ptr); > } > > // If there's an alpha channel convert gray to RGB > -if (info_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) > +if (color_type == PNG_COLOR_TYPE_GRAY_ALPHA) > { > png_set_gray_to_rgb(png_ptr); > } > @@ -408,11 +411,11 @@ > npy_intp dimensions[3]; > dimensions[0] = height; //numrows > dimensions[1] = width; //numcols > -if (info_ptr->color_type& PNG_COLOR_MASK_ALPHA) > +if (color_type& PNG_COLOR_MASK_ALPHA) > { > dimensions[2] = 4; //RGBA images > } > -else if (info_ptr->color_type& PNG_COLOR_MASK_COLOR) > +else if (color_type& PNG_COLOR_MASK_COLOR) > { > dimensions[2] = 3; //RGB images > } > @@ -421,7 +424,7 @@ > dimensions[2] = 1; //Greyscale images > } > //For gray, return an x by y array, not an x by y by 1 > -int num_dims = (info_ptr->color_type& PNG_COLOR_MASK_COLOR) ? 3 : 2; > +int num_dims = (color_type& PNG_COLOR_MASK_COLOR) ? 3 : 2; > > double max_value = (1<< ((bit_depth< 8) ? 8 : bit_depth)) - 1; > PyArrayObject *A = (PyArrayObject *) PyArray_SimpleNew( > > > kind regards, > dieter > > -- > vRanger cuts backup time in half-while increasing security. > With the market-leading solution for virtual backup and recovery, > you get blazing-fast, flexible, and affordable data protection. > Download your free trial now. > http://p.sf.net/sfu/quest-d2dcopy1 > ___ > Matplotlib-devel mailing list > Matplotlib-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel -- vRanger cuts backup time in half-while increasing security. With the market-leading solution for virtual backup and recovery, you get blazing-fast, flexible, and affordable data protection. Download your free trial now. http://p.sf.net/sfu/quest-d2dcopy1 ___ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel