Thread: Read more images at once

  1. #1
    Registered User
    Join Date
    Oct 2019
    Posts
    7

    Read more images at once

    Hi all. How can I read multiple images from a folder, then process them(add some effects) and then redirect them to a specific folder, with a specific name?
    Code:
     
        char input[] = "./input/images/file1.bmp";    
        char output[] = "./output/newfile1.bmp";
        FILE *fIn = fopen(input, "rb");
        FILE *fOut = fopen(output, "wb");
        if (!fIn || !fOut)
        {
            printf("File error.\n");
        }
    this is only part of the code. How can I process multiple images at once? From my example, only one image is processed.
    A little help please?

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Accessing command line parameters/arguments
    So for example, you could type
    myprog ./input/images/*.bmp ./output

    Or you could just specify the names of your input and output directories, and use this.
    Accessing a directory and all the files within it
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 3
    Last Post: 10-28-2015, 02:07 PM
  2. Read and process HDR images
    By in_ship in forum C Programming
    Replies: 0
    Last Post: 11-13-2012, 09:40 AM
  3. How to read images with argc & argv?
    By tommy_chai in forum C Programming
    Replies: 9
    Last Post: 11-20-2007, 08:35 PM
  4. PGM images
    By bokkie in forum C++ Programming
    Replies: 1
    Last Post: 03-17-2005, 08:48 AM

Tags for this Thread