Thread: How can I save an image to file.

  1. #1
    Registered User
    Join Date
    Jan 2010

    How can I save an image to file.

    How can I save an image to file.
    Loadimage Ole works fine, but how do I save loaded image to file.
    For example, using your example, I wrote a little pgm to load(loadimage OLE) an image, and scans image pixels, to determine all colors, then create a palette(Draw Rectangle) of all colors.
    Now I want to SAVE that palette of Rectangle as a *.png file.

  2. #2
    Registered /usr
    Join Date
    Aug 2001
    Newport, South Wales, UK
    Unfortunately, while loading images is largely intrinsic within Windows, saving images is considered a specialist function of an editor of some sort. No single function will do this for you.

    I implemented a PNG save function after reading the PNG spec. It gets quite complicated though, especially the Adam7 interlacing. I like the rough stuff myself.

    If you don't want to go to those lengths, you have a few options:-

    1. You could link to the libpng library, which is the official cross-platform PNG support library. Obviously you'll have to get the hang of its function parameters, but this is the way it's usually done.

    2. GDI+ includes what is termed an encoder for PNG images. GDI+ is included with every version of Windows since XP. Takes a bit of getting used to, but you may prefer this way.

    You should be able to find steps to use both of these methods via Google.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Arrays and their Application to image processing
    By quintenmater in forum C Programming
    Replies: 7
    Last Post: 12-10-2010, 02:10 PM
  2. How to get image from the screen and then save it to a file?
    By nomer in forum Windows Programming
    Replies: 2
    Last Post: 05-25-2006, 08:46 AM
  3. Batch file programming
    By year2038bug in forum Tech Board
    Replies: 10
    Last Post: 09-05-2005, 03:30 PM
  4. Ask user to save file before exiting.
    By Bajanine in forum Windows Programming
    Replies: 3
    Last Post: 11-15-2004, 06:34 PM
  5. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM

Tags for this Thread