Take the first row a swap it with the last row. Do this for the first height/2 rows then we have a inverted swapped image.
#define swap(x,y) {int temp;temp=x;x=y;y=temp;}
void invert_picture(GdkPixbuf *pb) //ulta 180* degree turn
{
int ht,wt;
int i=0,j=0;
int rowstride=0;
gchar *pixel;
ht=gdk_pixbuf_get_height(pb);
wt=gdk_pixbuf_get_width(pb);
pixel=gdk_pixbuf_get_pixels(pb);
rowstride=gdk_pixbuf_get_rowstride(pb);
for(i=0;i<ht/2;i++) //half the height!
for(j=0;j<rowstride;j+=3)
{
swap(pixel[i*rowstride+j+0],pixel[(ht-i)*rowstride+j+0]);
swap(pixel[i*rowstride+j+1],pixel[(ht-i)*rowstride+j+1]);
swap(pixel[i*rowstride+j+2],pixel[(ht-i)*rowstride+j+2]);
}
return;
}