[GRASS-dev] [GRASS GIS] #3600: m.nviz.image doesn't produce any output
GRASS GIS
trac at osgeo.org
Mon Jul 2 08:02:57 PDT 2018
#3600: m.nviz.image doesn't produce any output
---------------------+-------------------------
Reporter: guano | Owner: grass-dev@…
Type: defect | Status: new
Priority: normal | Milestone:
Component: Default | Version: 7.0.4
Keywords: | CPU: Unspecified
Platform: MacOSX |
---------------------+-------------------------
When trying to create some images with m.nviz.image, but all I get as
output is a 11 byte ppm...
All I get is an unreadable ppm with 11 bytes. With format=tif, I get an
error creating the file (TIFFScanlineSize64: Computed scanline size is
zero.).
Opening the ppm file into a text editor, I see that all that was written
was the header, and that the image size was 0,0:
P6
0 0
255
navigating trough the code, I see that m.nviz.image calls GS_write_ppm to
write the file, which is in lib/ogsf/gsd_img_ppm.c:
int GS_write_ppm(const char *name)
{
unsigned int x;
int y;
unsigned int xsize, ysize;
FILE *fp;
unsigned char *pixbuf;
gsd_getimage(&pixbuf, &xsize, &ysize);
if (NULL == (fp = fopen(name, "w"))) {
G_warning(_("Unable to open file <%s> for writing"), name);
return (1);
}
fprintf(fp, "P6\n%d %d\n255\n", xsize, ysize);
for (y = ysize - 1; y >= 0; y--) {
for (x = 0; x < xsize; x++) {
unsigned char r = pixbuf[(y * xsize + x) * 4 + 0];
unsigned char g = pixbuf[(y * xsize + x) * 4 + 1];
unsigned char b = pixbuf[(y * xsize + x) * 4 + 2];
fputc((int)r, fp);
fputc((int)g, fp);
fputc((int)b, fp);
}
}
G_free(pixbuf);
fclose(fp);
return (0);
}
GS_write_ppm calls gsd_getimage to get the actual image data and size.
So it seems to me that gsd_getimage is not getting the image?
--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3600>
GRASS GIS <https://grass.osgeo.org>
More information about the grass-dev
mailing list