All pastes #485981 Raw Edit

GD segmentation faul

public c v1 · immutable
·published 2007-05-13 18:04 UTC
rendered paste body
#include <stdio.h>#include <stdlib.h>#include <gd.h>int main(int argc, char** argv){  FILE *in;  gdImagePtr im;  int c;  in = fopen("S4020198.JPG", "rb");  im = gdImageCreateFromJpeg(in);  fclose(in);  c = gdImageGetPixel(im, gdImageSX(im) / 2, gdImageSY(im) / 2);  printf("The value of the center pixel is %d; RGB values are %d,%d,%d\n",c, im->red[c], im->green[c], im->blue[c]);  gdImageDestroy(im);  return 0;}