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

Discussion in 'C Programming' started by Rumesh Krishnan, Apr 8, 2014.

  1. 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.?
     
    Rumesh Krishnan, Apr 8, 2014
    #1
    1. Advertisements

  2. Go onto the Baby X source forge site (http://sourceforge.net/projects/babyx/?source=directory) and
    download the resource compiler. It has a PNG codec incorporated into it (not written by me).
     
    Malcolm McLean, Apr 8, 2014
    #2
    1. Advertisements

  3. Rumesh Krishnan

    Ian Collins Guest

    libgd is the most common image file library:

    http://libgd.bitbucket.org/
     
    Ian Collins, Apr 8, 2014
    #3
  4. Rumesh Krishnan

    Joe Pfeiffer Guest

    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.
     
    Joe Pfeiffer, Apr 8, 2014
    #4
  5. 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???
     
    Kenny McCormack, Apr 8, 2014
    #5
  6. Rumesh Krishnan

    Ken Brody Guest

    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.)
     
    Ken Brody, Apr 8, 2014
    #6
  7. Rumesh Krishnan

    James Kuyper Guest

    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.
     
    James Kuyper, Apr 8, 2014
    #7
  8. Rumesh Krishnan

    Joe Pfeiffer Guest

    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?
     
    Joe Pfeiffer, Apr 8, 2014
    #8
  9. [...]

    I advise against feeding the troll.
     
    Keith Thompson, Apr 8, 2014
    #9
  10. Rumesh Krishnan

    Kaz Kylheku Guest

    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.
     
    Kaz Kylheku, Apr 8, 2014
    #10
  11. 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".
     
    Malcolm McLean, Apr 8, 2014
    #11
  12. Rumesh Krishnan

    Ian Collins Guest

    Since when is slagging someone off for giving good advice keeping it real?
     
    Ian Collins, Apr 8, 2014
    #12
  13. Rumesh Krishnan

    Joe Pfeiffer Guest

    He may do so occasionally. But that's sure not the norm.
     
    Joe Pfeiffer, Apr 8, 2014
    #13
  14. I advise against feeding the other troll as well.
     
    Keith Thompson, Apr 9, 2014
    #14
  15. Rumesh Krishnan

    Joe Pfeiffer Guest

    Yeah, you're right. Sorry.
     
    Joe Pfeiffer, Apr 9, 2014
    #15
  16. Rumesh Krishnan

    viju.kantah Guest

    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)
     
    viju.kantah, Apr 9, 2014
    #16
  17. thank u so much..
     
    Rumesh Krishnan, Apr 11, 2014
    #17
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.