Thread: help with compressing images

  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    9

    help with compressing images

    hi there
    Can anyone plz help me with compressing a JPEG image with c programming on windowsxp.
    thanx in advance

  2. #2
    Technical Lead QuantumPete's Avatar
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    894
    I thought a JPEG image was already compressed... am I missing something?

    QuantumPete
    "No-one else has reported this problem, you're either crazy or a liar" - Dogbert Technical Support
    "Have you tried turning it off and on again?" - The IT Crowd

  3. #3
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    2 choices:
    * Learn how to read jpegs and compress them yourself
    * Use a 3rd party library, see http://www.ijg.org/
    Or something like libgd

    Quote Originally Posted by QuantumPete
    I thought a JPEG image was already compressed... am I missing something?
    A jpeg doesn't necessarily have to be compressed, jpeg can be compressed on several levels [1-100] "qualities", 1 being the worst, 100 being the best since it's a lossy format.
    Last edited by zacs7; 08-31-2007 at 04:47 AM.

  4. #4
    Registered User
    Join Date
    Aug 2007
    Posts
    9
    JPEG i am talking about is not a compressed image ..
    Last edited by dragunov; 08-31-2007 at 04:47 AM.

  5. #5
    Registered User
    Join Date
    Aug 2007
    Posts
    9
    thanx for the reply all of u..

  6. #6
    Registered User
    Join Date
    Aug 2007
    Posts
    9
    oops i missed something
    i am talking about compressing a bmp image
    sorry..

  7. #7
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Then convert it to JPEG or PNG! Or run it through some compression library such as zip, gzip, LWZ or such.

    Windows is capable to natively supporting at least JPEG, I think.

    --
    Mats

  8. #8
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Quote Originally Posted by matsp
    Windows is capable to natively supporting at least JPEG, I think.
    Only with GDI+

    Still libgd is the easiest way I'd say, or GDI+

  9. #9
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by zacs7 View Post
    Only with GDI+

    Still libgd is the easiest way I'd say, or GDI+
    Yes, I realized that only GDI+ supports it. Not sure where GDI+ was introduced, WinXP or Vista?

    Edit: it's a separate SDK that can be used for almost any recent Win32 version, see: http://msdn2.microsoft.com/en-us/library/ms533798.aspx

    Image::Save in GDI+:
    http://msdn2.microsoft.com/en-us/library/ms535407.aspx

    --
    Mats

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. mirroring website with images on external host
    By cyberfish in forum Tech Board
    Replies: 1
    Last Post: 09-08-2008, 06:50 PM
  2. CBitmap + big images = bad?
    By dug in forum Windows Programming
    Replies: 18
    Last Post: 06-28-2003, 11:53 PM
  3. Images
    By gvector1 in forum C++ Programming
    Replies: 7
    Last Post: 02-25-2003, 09:59 AM
  4. images, icons, and cursors, OH MY!
    By DarkViper in forum Windows Programming
    Replies: 3
    Last Post: 01-07-2003, 02:26 PM
  5. STL, Queues And Images
    By simly01 in forum C++ Programming
    Replies: 3
    Last Post: 06-24-2002, 12:31 PM