Menu

#2 Pdiff can't open 96-bit or 128-bit floating point TIFFs

open
nobody
None
5
2014-01-15
2014-01-14
No

Pdiff can't open 96-bit or 128-bit floating point TIFFs

I generate 128-bit floating point TIFFs and when running pdiff, it would report

Failed to load the image foo.tiff
FAIL: Cannot open foo.tiff

Reproducible Steps:
1. using the image attached, run pdiff foo.tiff foo.tiff

Pdiff reports an error

FreeImage supports 128-bit TIFFs, but it looks like Pdiff is assuming the image doesn't use 32-bit color depth and is trying to convert all images to 32 bits per color channel. FreeImage returns NULL when asked to convert an 32-bit color depth image to 32-bit color depth. Assuming FreeImage is correct, Pdiff shouldn't try to convert 96-bit or 128-bit images.

Discussion

  • Mark MacVicar

    Mark MacVicar - 2014-01-15

    This change fixes this issue

    Index: RGBAImage.cpp
    ===================================================================
    --- RGBAImage.cpp       (revision 53)
    +++ RGBAImage.cpp       (working copy)
    @@ -96,14 +96,28 @@
            }
    
            FIBITMAP* freeImage = 0;
    +
            if(FIBITMAP* temporary = FreeImage_Load(fileType, filename, 0))
            {
    -               freeImage = FreeImage_ConvertTo32Bits(temporary);
    +               // Convert images to 32-bits per color channel, unless they already
    +               // are 32-bits per color channel
    +               const FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(temporary);
    +               if ((image_type == FIT_RGBF) || (image_type == FIT_RGBAF))
    +               {
    +                       freeImage = temporary;
    +               } else
    +               {
    +                       freeImage = FreeImage_ConvertTo32Bits(temporary);
    +               }
                    FreeImage_Unload(temporary);
    +       } else
    +       {
    +               printf( "Failed to load the image %s\n", filename);
    +               return 0;
            }
            if(!freeImage)
            {
    -               printf( "Failed to load the image %s\n", filename);
    +               printf( "Failed to convert the image %s\n", filename);
                    return 0;
            }
    
     
    • yeehector

      yeehector - 2014-01-15

      Thanks how can I get this patch in I haven't used sourceforge in years is
      it possible to give you commit rights?
      On Jan 14, 2014 5:19 PM, "Mark MacVicar" mmacvicar@users.sf.net wrote:

      This change fixes this issue

      Index: RGBAImage.cpp===================================================================--- RGBAImage.cpp (revision 53)+++ RGBAImage.cpp (working copy)@@ -96,14 +96,28 @@
      }

          FIBITMAP* freeImage = 0;+
          if(FIBITMAP* temporary = FreeImage_Load(fileType, filename, 0))
          {-               freeImage = FreeImage_ConvertTo32Bits(temporary);+               // Convert images to 32-bits per color channel, unless they already+               // are 32-bits per color channel+               const FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(temporary);+               if ((image_type == FIT_RGBF) || (image_type == FIT_RGBAF))+               {+                       freeImage = temporary;+               } else+               {+                       freeImage = FreeImage_ConvertTo32Bits(temporary);+               }
                  FreeImage_Unload(temporary);+       } else+       {+               printf( "Failed to load the image %s\n", filename);+               return 0;
          }
          if(!freeImage)
          {-               printf( "Failed to load the image %s\n", filename);+               printf( "Failed to convert the image %s\n", filename);
                  return 0;
          }
      

      Status: open
      Created: Tue Jan 14, 2014 11:07 PM UTC by Mark MacVicar
      Last Updated: Tue Jan 14, 2014 11:07 PM UTC
      Owner: nobody

      Pdiff can't open 96-bit or 128-bit floating point TIFFs

      I generate 128-bit floating point TIFFs and when running pdiff, it would
      report

      Failed to load the image foo.tiff
      FAIL: Cannot open foo.tiff

      Reproducible Steps:
      1. using the image attached, run pdiff foo.tiff foo.tiff

      Pdiff reports an error

      FreeImage supports 128-bit TIFFs, but it looks like Pdiff is assuming the
      image doesn't use 32-bit color depth and is trying to convert all images to
      32 bits per color channel. FreeImage returns NULL when asked to convert an
      32-bit color depth image to 32-bit color depth. Assuming FreeImage is
      correct, Pdiff shouldn't try to convert 96-bit or 128-bit images.


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/pdiff/feature-requests/2/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       
      • Mark MacVicar

        Mark MacVicar - 2014-01-15

        According to
        http://sourceforge.net/apps/trac/sourceforge/wiki/Subversion%20permissions%20management,
        a project developer or administrator could give me permission. I'll gladly
        commit it. I might even update the projects to VS2010 or VS2012, but doubt
        I'll be much more help than that.

        Thanks,

        Mark MacVicar

        On Tue, Jan 14, 2014 at 5:44 PM, yeehector yeehector@users.sf.net wrote:

        Thanks how can I get this patch in I haven't used sourceforge in years is
        it possible to give you commit rights?

        On Jan 14, 2014 5:19 PM, "Mark MacVicar" mmacvicar@users.sf.net wrote:

        This change fixes this issue

        Index:
        RGBAImage.cpp===================================================================---
        RGBAImage.cpp (revision 53)+++ RGBAImage.cpp (working copy)@@ -96,14 +96,28
        @@
        }

        FIBITMAP* freeImage = 0;+
        if(FIBITMAP* temporary = FreeImage_Load(fileType, filename, 0))
        
        {-               freeImage = FreeImage_ConvertTo32Bits(temporary);+               // Convert images to 32-bits per color channel, unless they already+               // are 32-bits per color channel+               const FREE_IMAGE_TYPE image_type = FreeImage_GetImageType(temporary);+               if ((image_type == FIT_RGBF) || (image_type == FIT_RGBAF))+               {+                       freeImage = temporary;+               } else+               {+                       freeImage = FreeImage_ConvertTo32Bits(temporary);+               }
                FreeImage_Unload(temporary);+       } else+       {+               printf( "Failed to load the image %s\n", filename);+               return 0;
        
        }
        if(!freeImage)
        {-               printf( "Failed to load the image %s\n", filename);+               printf( "Failed to convert the image %s\n", filename);
                return 0;
        }
        

        Status: open
        Created: Tue Jan 14, 2014 11:07 PM UTC by Mark MacVicar
        Last Updated: Tue Jan 14, 2014 11:07 PM UTC
        Owner: nobody

        Pdiff can't open 96-bit or 128-bit floating point TIFFs

        I generate 128-bit floating point TIFFs and when running pdiff, it would
        report

        Failed to load the image foo.tiff
        FAIL: Cannot open foo.tiff

        Reproducible Steps:
        1. using the image attached, run pdiff foo.tiff foo.tiff

        Pdiff reports an error

        FreeImage supports 128-bit TIFFs, but it looks like Pdiff is assuming the
        image doesn't use 32-bit color depth and is trying to convert all images to
        32 bits per color channel. FreeImage returns NULL when asked to convert an
        32-bit color depth image to 32-bit color depth. Assuming FreeImage is
        correct, Pdiff shouldn't try to convert 96-bit or 128-bit images.


        Sent from sourceforge.net because you indicated interest in
        https://sourceforge.net/p/pdiff/feature-requests/2/

        To unsubscribe from further messages, please visit
        https://sourceforge.net/auth/subscriptions/


        Status: open
        Created: Tue Jan 14, 2014 11:07 PM UTC by Mark MacVicar
        Last Updated: Wed Jan 15, 2014 01:19 AM UTC
        Owner: nobody

        Pdiff can't open 96-bit or 128-bit floating point TIFFs

        I generate 128-bit floating point TIFFs and when running pdiff, it would
        report

        Failed to load the image foo.tiff
        FAIL: Cannot open foo.tiff

        Reproducible Steps:
        1. using the image attached, run pdiff foo.tiff foo.tiff

        Pdiff reports an error

        FreeImage supports 128-bit TIFFs, but it looks like Pdiff is assuming the
        image doesn't use 32-bit color depth and is trying to convert all images to
        32 bits per color channel. FreeImage returns NULL when asked to convert an
        32-bit color depth image to 32-bit color depth. Assuming FreeImage is
        correct, Pdiff shouldn't try to convert 96-bit or 128-bit images.


        Sent from sourceforge.net because you indicated interest in
        https://sourceforge.net/p/pdiff/feature-requests/2/

        To unsubscribe from further messages, please visit
        https://sourceforge.net/auth/subscriptions/

         

Log in to post a comment.