Results 1 to 5 of 5

Thread: CImg: jpg file unknown format.

  1. #1
    Join Date
    Aug 2009
    Beans
    1

    CImg: jpg file unknown format.

    Hi,
    I wrote a small program using CImg library and g++ compiler and I installed imagemagick v6.5.6.

    The code is as follows

    Code:
    #include "CImg.h"
    using namespace cimg_library;
    
    int main(){
         CImg <unsigned char> img("train.jpg");
         img.display("Train");
    
         return 0;
    }
    


    The program passes compliation but when I run the program, an error message

    "CImg <unsigned char>:: load() "train.jpg", format not recognized" prompts me.

    What could be cause? Thanks.

  2. #2
    Join Date
    Jul 2011
    Beans
    2

    Re: CImg: jpg file unknown format.

    Hi,
    I have a similar problem for the format .tiff
    The error displayed is the following:

    sh: convert: not found
    sh: gm: not found
    sh: convert: not found
    sh: gm: not found
    sh: convert: not found
    sh: gm: not found
    terminate called after throwing an instance of 'cimg_library::CImgIOException'
    what(): [instance(0,0,0,0,(nil),non-shared)] CImg<float>::load() : Failed to recognize format of file './Train/8008_024.tiff'.
    I'm going crazy searching a solution at this error.

    Please help!

  3. #3
    Join Date
    Jul 2011
    Beans
    2

    Re: CImg: jpg file unknown format.

    Hey,
    there is someone who can help me?
    I can't understand this problem

  4. #4
    Join Date
    Apr 2013
    Beans
    1

    Re: CImg: jpg file unknown format.

    I have also faced the same problem, but found a solution, after few tries.

    Download CImg.h from the website - http://cimg.sourceforge.net/download.shtml
    and place it in the same folder as the cpp file.


    if the below errors are still found
    ------------
    sh: 1: convert: not found
    sh: 1: gm: not found
    sh: 1: convert: not found
    sh: 1: gm: not found
    sh: 1: convert: not found
    sh: 1: gm: not found
    --------------
    Run the command in ubuntu, or install imagemagick
    >sudo apt-get install imagemagick libmagickcore-dev

    Hopefully, this should solve the prob

  5. #5
    Join Date
    Jun 2007
    Location
    Porirua, New Zealand
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: CImg: jpg file unknown format.

    If a post is older than a year or so and hasn't had a new reply in that time, instead of replying to it, create a new thread. In the software world, a lot can change in a very short time, and doing things this way makes it more likely that you will find the best information. You may link to the original discussion in the new thread if you think it may be helpful.
    Forum DOs and DON'Ts
    Never assume that information you find using a search engine is up-to-date.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •