LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-20-2008, 11:38 AM   #1
sumitshining
Member
 
Registered: Oct 2008
Distribution: Fedora, Ubuntu
Posts: 30

Rep: Reputation: 15
image pixel information retrieval in gtk ?


I have retrieved an image. Now I have to retrieve pixel information.
I tried the following code...

width = gdk_pixbuf_get_width (pixbuf);
height = gdk_pixbuf_get_height (pixbuf);

rowstride = gdk_pixbuf_get_rowstride (pixbuf);
pixels = gdk_pixbuf_get_pixels (pixbuf);

for(y=0;y<height;y++)
{ for(x=0;x<width;x++)
{p = pixels + y * rowstride + x * n_channels;
}
}

its ok with that, but when I'm trying to print this data or use this data anyway simultaneously....using following method:
printf("%d",p[0]);
printf("%d",p[1]);
printf("%d",p[2]);

following error is recieved:
subscripted value is neither array nor pointer

So can anyone tell me, where's the error?

Last edited by sumitshining; 12-20-2008 at 11:39 AM.
 
Old 12-20-2008, 02:37 PM   #2
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by sumitshining View Post
So can anyone tell me, where's the error?
What is "p" declared as?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
GTK/GDK 1.2 GdkPixmap: Set a pixel with a color TTL_2 Programming 2 01-14-2013 01:48 AM
Running Pixel Image editor caa1980 Linux - Software 6 10-03-2007 06:17 PM
image pixel information WebGraphics Linux - Software 3 06-13-2007 07:18 AM
LXer: Review: Pixel image editor LXer Syndicated Linux News 0 12-15-2005 03:31 AM
How to grab the pixel image output by OpenGL phil123 Linux - General 1 02-26-2004 07:51 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:05 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration