ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 TIFF photos do not display but TIFF documents do.
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

Homer

USA
70 Posts

Posted - Jan 23 2022 :  19:09:05  Show Profile  Reply
I've been looking for a property or some setting that would fix this, but I'm drawing blanks.

Using the exact same procedure, the LoadFromFile function displays single or multi-page TIFF documents containing text normally. However, if I load a TIFF photograph, it just displays the background color and no image.

Is there a property or some steps I should make in code that will allow either to be displayed?

BTW, the TIFF photos are created using GIMP from camera raw photos. Sony a6000.

xequte

38608 Posts

Posted - Jan 23 2022 :  23:12:36  Show Profile  Reply
Sorry, I'm not understanding what you are describing. Can you attach some screenshots?

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Homer

USA
70 Posts

Posted - Jan 24 2022 :  18:53:30  Show Profile  Reply
These two images were acquired using the same routine, and are displayed using the same code. The first screen copy is a document (mostly text) and is 87.4KB. The second is a photo that is 274MB. I have verified that the photo actually is in the correct path, named properly, and is not corrupt. I tried to attach it as a third image, but I think it was too large. It timed out during the upload so I made a screen copy of Windows File Explorer with that file displayed in the preview pane.









Go to Top of Page

Homer

USA
70 Posts

Posted - Jan 24 2022 :  18:55:51  Show Profile  Reply
Sorry, I guess I forgot to attach the screen copy of Windows File Explorer.



Go to Top of Page

xequte

38608 Posts

Posted - Jan 24 2022 :  19:59:49  Show Profile  Reply
So, you can load B+W TIFF files, but are unable to load color TIFF files?

Can you show me your loading code, and attach/send the TIFF file that doesn't load.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Homer

USA
70 Posts

Posted - Jan 25 2022 :  00:01:25  Show Profile  Reply
I don't think it has anything to do with color vs. B&W. I tried to attach two photos, one that worked and one that didn't. Both were color, and typical of photos my customers might try to load. They were too big to attach. I'll send you a DropBox link for the two files. The smaller one worked, but the larger one did not. I think it might have something to do with file size. I've included my code.

procedure TfrmMain.LoadSelectedDocument;
Var
  FilNme,
  FileExt: string;
Const
  OneK = 1024.0;
  OneM = 1048576.0;
begin
  {$IFDEF UseCodeSite}
  CodeSite.TraceMethod('qImageListAfterScroll');
  {$ENDIF}
  tmrScrollPause.Enabled := False;

  showloadingform; // a splash screen that is hidden once the file is loaded.
  Screen.Cursor := crHourGlass;
  try
    try
      try
        If not isNewImage then
        begin
          If FileExists(gsDocManPath + qImageList.FieldByName('ImageName').AsString) then
          begin
            FilNme := Trim(gsDocManPath + qImageList.FieldByName('ImageName').AsString);
            (***  modified by David Cornelius to load multiple images and PDFs  ***)
            FileExt :=
              Trim(UpperCase(ExtractFileExt(qImageList.FieldByName('ImageName').AsString)));

            rzStatusPane2.Caption := 'Size: ' + ConvertBytes(GetImageFileSize(FilNme));
  {===============================================================================
   =====                        Actually get files                          ======
   ================================================================================}
            if FileExt = '.TIF' then
            begin
              // if it's a .TIF file, we know it's capable of multiple images
              ClearAllDocs;
              iemvPageThumbs.StoreType := ietNormal;
              ViewTIF;
            end
            else
            if (FileExt = '.PNG') or (FileExt = '.JPG') or (FileExt = '.BMP') then
            begin
              iemvPageThumbs.StoreType := ietNormal;
              ClearAllDocs;
              ViewPNG;
            end
            else
            if (FileExt = '.PDF') then
            begin
              ClearAllDocs;
              ViewPDF;
            end
            else if (FileExt = '.DOCX') or (FileExt = '.DOC') then
            begin
              NewFileName := qImageList.FieldByName('ImageName').AsString;
              ClearAllDocs;
              ViewWordDoc;
            end;
          end
          else
          begin
            {JPG or PNG handler.}
            ClearAllDocs;
            gbView.Caption := 'Photo/Image View:';
            DisablePdfViewer;
            ImageEnView1.Clear;
            // "if" added by David Cornelius, May, 2004 to prevent this message when
            // the last image is deleted
            // the following statement previously stated > 0 rather than = 0
            if Length(qImageList.FieldByName('ImageName').AsString) = 0 then
              MessageBox(Application.Handle,PChar('No documents found.'),
                 'Information', MB_OK);
          end;
        end;

        Application.ProcessMessages;
        isNewImage := False;
        CurrentFileName := qImageList.FieldByName('ImageName').AsString;

        qImageList.EnableControls;
        ShowLink;  {Account, member, or policy}
        RzStatusPane3.Caption := 'File: ' +qImageList. FieldByName('ImageName').AsString;
        //    ProgressBar1.Percent := 0;
        Application.ProcessMessages;
      finally
        cxGrd1.Refresh;
        Case LastZoomSelection of
          lzsCustom : ImageEnView1.Zoom := ZoomFactor;
          lzsBestFit: ImageEnView1.Fit;
          lzsWidth: mnuFillWindowWidth1.Click;
          lzsActualSize: mnu100Percent.Click;
        End;
  //      Screen.Cursor := crDefault;
      end;
    except
      on E : Exception do
      begin
        {I haven't seen this message since Adobe Acrobat DC. }
        if pos('ole',LowerCase(E.Message)) <> 0 then
          MessageBox(Application.Handle,
            pChar('Document can''t be displayed. Please make sure you have installed '+
            'the latest version of Adobe Acrobat Viewer. Yours may be out-of-date.'),
            pChar('Document Error'), MB_OK + MB_ICONERROR);
      end;
    end;
  finally
    Screen.Cursor := crDefault;
    hideloadingform ;
  end;

end;


procedure TfrmMain.ViewTIF;
begin
  {$IFDEF UseCodeSite}
  CodeSiteEx.TraceMethod(self, 'ViewTIF');
  {$ENDIF}

  try
    Screen.Cursor := crHourglass;
    // Disable OleContainer. It's not needed by TIF files.
    if (OleContainer1.State = osRunning) then
    begin
      try
      OleContainer1.DestroyObject;
      Except
        MessageBox(Application.Handle, PChar('Error closing Word.'), PChar('FYI'), MB_OK + MB_ICONINFORMATION);
      end;
    end;
    // change menu
    mnuitmCombinePages.Caption := 'Add/Arrange &Pages';

    // Make old image invisible;
    ImageEnView1.Blank;
    // disable PDF viewing
    DisablePdfViewer; //hides the AcroPDF.DLL window.
    // clear any previous thumbnails hanging around
    iemvPageThumbs.Clear;
    // load the .TIF file into the thumbnails to select different frames
    iemvPageThumbs.MIO.LoadFromFileTIFF(Trim(gsDocManPath + qImageList.FieldByName('ImageName').AsString));
    Application.ProcessMessages;
  //  // change menu
  //  mnuitmCombinePages.Caption := 'Add/Arrange &Pages';

    // highlight first thumbnail
    if iemvPageThumbs.ImageCount > 0 then iemvPageThumbs.SelectedImage := 0;
    Application.ProcessMessages;
    ImageEnView1.FitToWidth;
    // show the thumbnail panel
    iemvPageThumbs.Visible := True;
    iemvPageThumbsImageSelect(nil,0);
    iemvPageThumbs.Invalidate ;
    EnableDocMenuItems; // enables or disables button and menu items based on document type (extension).
    gbView.Caption := 'Document View:';
    {This grid displayes all saved documents, and allows the user to select one to view.}
    cxgrd1.Invalidate(True);
  finally
    Screen.Cursor := crDefault;
  end;
end;

Go to Top of Page

xequte

38608 Posts

Posted - Jan 25 2022 :  17:34:42  Show Profile  Reply
Yes, we do not support this TIFF type, at present. We will investigate.



Nigel
Xequte Software
www.imageen.com
Go to Top of Page

Homer

USA
70 Posts

Posted - Jan 25 2022 :  18:26:36  Show Profile  Reply
That's great. Let me know if you need more samples to play with.
Go to Top of Page

xequte

38608 Posts

Posted - Jan 30 2022 :  19:26:31  Show Profile  Reply
Hi

You can email me to test a fix for this.

Nigel
Xequte Software
www.imageen.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: