Just add an offset to the original image's pixel components[Red,Green,Blue] and then make it look like really bright. Please tweak with the value of offset to get a decent level of brightness.
pixel.red += offset;
pixel.green += offset;
pixel.blue += offset;
some one please fix it! This effect is really bad!
#include<gtk/gtk.h>
void colorbright_picture(GdkPixbuf *pb,int offset)
{
int ht,wt;
int i=0,j=0;
int rowstride=0;
int bpp=0;
gchar *pixel;
if(gdk_pixbuf_get_bits_per_sample(pb)!=8) //we handle only 24 bit images.
return; //look at 3 bytes per pixel.
bpp=3; //getting attributes of height,
ht=gdk_pixbuf_get_height(pb); //width, and bpp.Also get pointer
wt=gdk_pixbuf_get_width(pb); //to pixels.
pixel=gdk_pixbuf_get_pixels(pb);
rowstride=wt*bpp;
for(i=0;i<ht;i++) //iterate over the height of image.
for(j=0;j<rowstride;j+=bpp) //read every pixel in the row.skip
//bpp bytes
{
//Manipulate Red.
if((pixel[i*rowstride + j+0]+offset) >= 0xff)
{
pixel[i*rowstride + j+0]=0xff;
}
else if((pixel[i*rowstride + j+0]-offset) < 0)
{
pixel[i*rowstride + j+0]=0;
}
else
pixel[i*rowstride + j+0]+=offset;
//Manip Green
if((pixel[i*rowstride + j+1]+offset) >= 0xff)
{
pixel[i*rowstride + j+1]=0xff;
}
else if((pixel[i*rowstride + j+1]-offset) < 0)
{
pixel[i*rowstride + j+1]=0;
}
else
pixel[i*rowstride + j+1]+=offset;
//Manip Blue
if((pixel[i*rowstride + j+2]+offset) >= 0xff)
{
pixel[i*rowstride + j+2]=0xff;
}
else if((pixel[i*rowstride + j+2]-offset) < 0)
{
pixel[i*rowstride + j+2]=0;
}
else
pixel[i*rowstride + j+2]+=offset;
}
return;
}
% <!-- provide link here-->
% complete working example with glue code in example_bright.c