freeimage image jp2 cannot convert to jpg

2014-01-02
2014-01-05
  • Hi to all,
    i want to convert a jp2 file to jpg.
    i am using this code:

                FIBITMAP dib = FreeImage.LoadEx(origFile);
                if (!dib.IsNull)
                {
                    //save the image out to disk    
                    FreeImage.Save(FREE_IMAGE_FORMAT.FIF_JPEG
                        , dib, destFile
                        , FREE_IMAGE_SAVE_FLAGS.JPEG_QUALITYNORMAL);
    
                }
    

    For some reason i really do not know, some pictures works just fine but some others don't.

    How can i start debug the problem?

    thanks in advance

     
    Attachments
  • As JPG is 24-BPP (except for Grayscale or CMYK), to save a 32-BPP JP2 DIB to it, you need to call ...ConvertTo24Bits first?

     
  • No same proble. pic distroyed

     
  • Since you had uploaded the resultant JPG rather than the source JP2, others cannot do a testing for you. Would you like to upload a JP2?

     
    Last edit: Johnny Petersen 2014-01-04
  • it is 32MB size.
    i will upload it to my skydrive and put the link here

     
  • It seems the problem doesn't lie with the conversion, but the loading of the subject 8000x6000 JP2 file. Per screenshot "JP2_8000x6000_Loaded_And_Resized_To_Screenful.jpg" which is appended below, only a small upper portion of the image is visible, the rest is a blank. I am not sure whether this is attributable to FreeImage or the original JP2 file itself (I haven't tested it with other programs).

     
  • so? ...