Loading...

Unable to read PhotometricInterpretation' tag 262 (hex 0x01)

Support for GdPicture Light Imaging Toolkit and GdPicture Pro Imaging ActiveX/SDK.

Unable to read PhotometricInterpretation' tag 262 (hex 0x01)

Postby justcode » Fri Jul 09, 2010 2:17 pm

Good Morning,

We have quite a few multipage tiff documents that some of the pages are displayed as inverted. It was determined that the Tiff tag: 'Photometric' is set to 1 (MinIsBlack) which is probably a mistake or bug in another software that generated the images. To correct this issue we tried to read this tag, but the SDK does not seem to return it. How do we read the 'PhotometricInterpretation' tag: 262 (hex 0x0106)??
http://www.awaresystems.be/imaging/tiff/tifftags/photometricinterpretation.html

And if we can read the tag, can we change it to have the viewer display the image the other way, or can we have the library ignore the tag all together? Does the long FxNegative() call use this tag?

Second, we noticed that if I take a tiff page that has 'Photometric' set to 1 (MinIsBlack) and write or append it to another tiff file, the 'Photometric' tag for the page becomes 0 (MinIsWhite) and the image is still displayed in the inverted state. Is this a known issue? Once this happens we can no longer use the 'Photometric' tag to detect an inverted page. I do have TagsSetPreserve(TRUE).

I also noticed that there is no TagsSetPreserve call for the viewer. Does this mean if the image is open in the viewer, we can not read the tags associated with it, using a method like this:
Code: Select all
 
....
ImageCtrl.SetNativeImage( ViewerCtrl.GetNativeImage());
long lTotal = ImageCtrl.ExifTagCount();         

for(long lIndex = 1; lIndex <= lTotal; lIndex++)
{
    long lValue = ImageCtrl.ExifTagGetID(lIndex);
    CString strName = ImageCtrl.ExifTagGetName(lIndex);
    CString strValue = ImageCtrl.ExifTagGetValueString(lIndex);

    // do something with the tags...
}


We are using:
GdPicture Pro Imaging SDK 5.13.2
Visual Studio 2003 on Windows 2000
MFC application.

What are my options for handling these inverted images programatically and making them correct. Any help would be greatly appreciated.
Thanks..
Paul R. Rondeau
Sr. Software Engineer
MultiProcess Computer Corporation
User avatar
justcode
 
Posts: 24
Joined: Wed Jul 15, 2009 9:20 pm

Re: Unable to read PhotometricInterpretation' tag 262 (hex 0

Postby Loïc » Mon Jul 12, 2010 1:51 pm

Hi Paul,

I have a solution for your issue. If I understand, sometime the first page of your multipage tiff documents is reverted because an invalid tool doesn't handle correctly the PhotometricInterpretation tag...

Here a vb code snippet to fix this issue. Please let me know if you don't understand everything:
Code: Select all
  Dim ImageID As Long
  Dim i As Long
  Dim bRevertFirstPage As Boolean
 
  'Open the image in read only mode using GDI+ codec to get PhotometricInterpretation metadata
  Imaging1.DisableGdimgplugCodecs (True)
  Imaging1.TiffOpenMultiPageAsReadOnly (True)
  ImageID = Imaging1.CreateImageFromFile("c:\0000000380.tif")

  'Getting PhotometricInterpretation tag 262 (hex 0x01)
  For i = 1 To Imaging1.ExifTagCount
     If Imaging1.ExifTagGetID(i) = 262 Then
        If Trim(Imaging1.ExifTagGetValueString(i)) = "1" Then 'we apply negative effect on such configuration
           bRevertFirstPage = True
        End If
     End If
  Next i
 
  Imaging1.CloseImage (ImageID)
 
  'Now open the image in read&write mode to revert the first page if needed !
 
  If bRevertFirstPage Then
     Imaging1.DisableGdimgplugCodecs (False)
     Imaging1.TiffOpenMultiPageAsReadOnly (False)
     ImageID = Imaging1.CreateImageFromFile("c:\0000000380.tif")
     Imaging1.FxNegative
     Call Imaging1.TiffSaveMultiPageToFile(ImageID, "c:\0000000380.tif", CompressionCCITT4)
     Imaging1.CloseImage (ImageID)
  End If


Kind regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4437
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: Unable to read PhotometricInterpretation' tag 262 (hex 0

Postby justcode » Mon Jul 12, 2010 3:14 pm

Thanks, I was unaware of the 'DisableGdimgplugCodecs()' call and it's purpose. I have enough information now to handle this situation. I am still learning how the different calls interact with each other. It would be nice if the help was a little more technical on what the calls do, their use and purpose, and what effects some calls have on others.

Thanks again,
Paul R. Rondeau
Sr. Software Engineer
MultiProcess Computer Corporation
User avatar
justcode
 
Posts: 24
Joined: Wed Jul 15, 2009 9:20 pm

Re: Unable to read PhotometricInterpretation' tag 262 (hex 0

Postby Loïc » Thu Jul 15, 2010 12:11 pm

Hi Paul,

You are right...

I just update this post to tell that in next release you will not have to use the DisableGdimgplugCodecs method. PhotometricInterpretation will be supported by all coded used in GdPicture.

Kind regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4437
Joined: Tue Oct 17, 2006 10:48 pm
Location: France


Return to GdPicture [Pro] ActiveX

Who is online

Users browsing this forum: No registered users and 1 guest