Loading Images in C

This is a discussion on Loading Images in C within the C Programming forums, part of the General Programming Boards category; Hi Everyone, im pretty new to C programming and i was wondering if anyone could help me out. I need ...

  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    2

    Question Loading Images in C

    Hi Everyone,

    im pretty new to C programming and i was wondering if anyone could help me out. I need to load still images in JPEG format into a C program and after this i need to run things like edge detection and filtering algorithms. I am using the Intel IPP 5.3 package which includes code for the edge detection and filtering but has nothing for loading images into C.

    Any advice or ideas??

    Thanks

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    libjpeg perhaps?

    Also be aware that Intel's code does not work on AMD processors - I don't know if AMD has a similar library, but I know their math libraries for example work just fine (and fast) on Intel processors too.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,459
    What image format does IPP support? YUV?
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  4. #4
    Registered User
    Join Date
    Feb 2008
    Posts
    2
    It supports JPEG, JPEG2000, BMP and YUV. Ideally i would like to keep the images in JPEG format as any sample code which i have access to is in this format, and as i am fairly new to C, i feel that i will probably need these sample codes as guides when it comes to later in the project

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    So presumably, then, you just have to load the image itself into memory. A simple piece of code using fopen() and fread() should do the trick, then. You may need some extra code to figure out the size of the image, but shouldn't be too big an issue.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  6. #6
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,590
    Without understanding the file format all your attempts will still not work. Find some info on the JPEG file format, use GDI+, or use some other thirdy party library to load the image.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Loading & Displaying Images
    By devarishi in forum C Programming
    Replies: 9
    Last Post: 12-10-2008, 06:05 PM
  2. loading images in open gl
    By lilhawk2892 in forum Game Programming
    Replies: 9
    Last Post: 08-11-2006, 06:55 PM
  3. Loading .jpg images from a file
    By Echidna in forum Windows Programming
    Replies: 4
    Last Post: 04-20-2002, 03:09 PM
  4. Loading images other than Bitmaps
    By Garfield in forum Windows Programming
    Replies: 18
    Last Post: 02-06-2002, 04:35 PM
  5. loading images
    By massive_attack in forum C++ Programming
    Replies: 2
    Last Post: 01-08-2002, 05:45 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21