How to read and write png image using c program.?

  • Thread starter Rumesh Krishnan
  • Start date
R

Rumesh Krishnan

I want to perform image processing using c program with opencl computing framework, how to read a png image in a simple way, after read the png image could be in a form of array. how to do .. any one help me.?
 
I

Ian Collins

Rumesh said:
I want to perform image processing using c program with opencl
computing framework, how to read a png image in a simple way, after
read the png image could be in a form of array. how to do .. any one
help me.?

libgd is the most common image file library:

http://libgd.bitbucket.org/
 
J

Joe Pfeiffer

Rumesh Krishnan said:
I want to perform image processing using c program with opencl
computing framework, how to read a png image in a simple way, after
read the png image could be in a form of array. how to do .. any one
help me.?

I'd suggest using libpng -- see
http://www.libpng.org/pub/png/libpng.html

There's a strong chance you'll get more useful answers in a group like
sci.image.processing, since it's more directly focussed at what you're
asking.
 
K

Kenny McCormack

I'd suggest using libpng -- see
http://www.libpng.org/pub/png/libpng.html

There's a strong chance you'll get more useful answers in a group like
sci.image.processing, since it's more directly focussed at what you're
asking.

Yeah! The nerve of people! Asking questions about C programming in a
newsgroup called (Surprise! Surprise!) comp.lang.c.

Don't they know? Have they really missed all the memos???
 
K

Ken Brody

Yeah! The nerve of people! Asking questions about C programming in a
newsgroup called (Surprise! Surprise!) comp.lang.c.

Don't they know? Have they really missed all the memos???

Not, this isn't about "C programming", it's about interpreting the contents
of a specific file type.

If you want to get picky (and I know you do), then the answer to "how to
read a png image" is "fopen(), fread(), and fclose()". (And, I suppose,
"fseek() and ftell()" to determine the size to malloc.)
 
J

James Kuyper

Not, this isn't about "C programming", it's about interpreting the contents
of a specific file type.

If you want to get picky (and I know you do), then the answer to "how to
read a png image" is "fopen(), fread(), and fclose()". (And, I suppose,
"fseek() and ftell()" to determine the size to malloc.)

Kenny is opposed to the idea of letting people know that there are
better places to get answers to their questions. It's a fact that, for
some reason, he thinks we have a moral obligation to conceal. Has he
ever actually answered one of these questions? I'd only know if someone
responded to his answer - offhand, I can't remember ever seeing such a
response.
 
J

Joe Pfeiffer

Yeah! The nerve of people! Asking questions about C programming in a
newsgroup called (Surprise! Surprise!) comp.lang.c.

Don't they know? Have they really missed all the memos???

What is it with you, anyway? The guy asked a question. I (1) gave the
best answer I could, and (2) pointed him at a likely better source of
answers. Did you give him any useful information? Did you point him at
a good library to investigate? Did you point him at a better source of
information? Did you, in fact, do anything except bitch and moan about
somebody whose attempt to be helpful included telling the OP to ask more
knowledgeable people? Did you, not to put too fine a point on it, do
anything useful whatever?
 
K

Keith Thompson

Joe Pfeiffer said:
(e-mail address removed) (Kenny McCormack) writes: [SNIP]

What is it with you, anyway?
[...]

I advise against feeding the troll.
 
K

Kaz Kylheku

Joe Pfeiffer said:
(e-mail address removed) (Kenny McCormack) writes: [SNIP]

What is it with you, anyway?
[...]

I advise against feeding the troll.

Nonsense. Kenny is a genuine Usenet participant who posts readable, useful,
on-topic articles in various newsgroups.

Kenny is simply opposed to wooden-limbed pedantry in programming language
discussions, and the associated recurrent personalities.
 
M

Malcolm McLean

Nonsense. Kenny is a genuine Usenet participant who posts readable, useful,
on-topic articles in various newsgroups.

Kenny is simply opposed to wooden-limbed pedantry in programming language
discussions, and the associated recurrent personalities.
But virtually every post of his is meta-topical. I've rarely seen Kenny post
an opinion or a helpful answer on C as such, even loosely defined as
"programming questions with a C element".
 
J

Joe Pfeiffer

Richard said:
Then you're not paying attention. He does so frequently. And had you had
half an ounce of common sense you could have checked that before posting
such an obviously bullshit defensive response.

He may do so occasionally. But that's sure not the norm.
 
V

viju.kantah

I want to perform image processing using c program with opencl computing framework, how to read a png image in a simple way, after read the png image could be in a form of array. how to do .. any one help me.?

Have you tried the GD library by Thomas Boutell?
Using it is simple

gdImageCreateFromPng(pngout) // Load the file
gdImageXX() // Your functions
gdImageDestroy(pngout)

Otherwise to read any file character by character, you can simply use the classic standard i/o function fgetc(pngout)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top