T O P I C R E V I E W |
AndNit |
Posted - Apr 08 2023 : 16:36:23 Hello
I have a process that opens a tif file in TimageEnMView using TIETIFFHandler and when selecting the thumbnail in TimageEnMView it opens in a TimageEnView. Within this TimageEnView I use the brush resources to mark some parts of the text, however I cannot update the TimageEnMView nor save the TIETIFFHandler with the markup edits made. I would like help for:
1 – update thumbnails in TimageEnMView with edits made in TimageEnView 2 - save these edits using the TIETIFFHandler |
7 L A T E S T R E P L I E S (Newest First) |
xequte |
Posted - Apr 15 2023 : 23:00:24 OK, that method is quite good, though you don't need to use a timer you can load the image in the event:
http://www.imageen.com/help/TImageEnMView.OnImageIDRequestEx.html
With regard to loading into TImageEnMView using LoadFromFileOnDemand(), you don't need to save using TImageEnMView.MIO.SaveToFileTIFF() because that would be very slow (and should not ever be used if StoreType = ietThumb).
I mean that saving should be handled by updating individual files as needed, i.e. when the user edits a TIFF page you load it into TImageEnView by setting the TIFF_ImageIndex to the current TImageEnMView index and then TImageEnView loads it:
procedure TfrmConsCert.OpenPageForEditing();
begin
if ( ImageEnMView1.ImageCount = 0 ) or
( ImageEnMView1.SelectedImage < 0 ) then
exit;
ImageEnView1.IO.Params.TIFF_ImageIndex := ImageEnMView1.SelectedImage;
ImageEnView1.IO.LoadFromFile( fCurrentFilename );
end;
And if the user edits the image then update the content of the TIFF file as follows...
procedure TfrmConsCert.UpdateTiffFile();
begin
ImageEnView1.IO.Params.TIFF_ImageIndex := ImageEnMView1.SelectedImage;
ImageEnView1.IO.ReplaceFileTIFF( fCurrentFilename );
end;
http://www.imageen.com/help/TImageEnIO.ReplaceFileTIFF.html
Nigel Xequte Software www.imageen.com
|
AndNit |
Posted - Apr 15 2023 : 14:36:29 Yes, before switching to TIETIFFHandler I used (ImageEnMView1.StoreType := ietThumb). My biggest problem without using TIETIFFHandler, would not even be opening the file only, but changes such as adding pages, deleting, saving the file again. When I'm handling a big tif file, and I use ImageEnMView1.MIO.savetofile it takes MUCH longer than using Tiff.WriteFile for example.
The procedure for opening my files and editing using TIETIFFHandler is taken from an example I took from your demos... it's as follows:
public
{ Public declarations }
Tiff : TIETIFFHandler;
TiffPageIndex: Integer;
procedure LoadCurrentTIFFPage();
procedure LoadTiffFile(const Filename: string);
end;
procedure TfrmConsCert.LoadTiffFile(const Filename: string);
var
I, idx: Integer;
begin
Tiff.ReadFile( FileName );
ImageEnMView1.LockUpdate();
ImageEnMView1.Clear;
for I := 0 to Tiff.GetPagesCount - 1 do
begin
// Add the ID's of all our source images
idx := ImageEnMView1.AppendImage();
ImageEnMView1.ImageID[ idx ] := 99; // Note: Number here doesn't matter as long as it is > -1. We will actually use the frame index to know which page to load
end;
ImageEnMView1.SelectedImage := 0;
ImageEnMView1.UnlockUpdate();
LoadCurrentTIFFPage();
end;
procedure TfrmConsCert.LoadCurrentTIFFPage;
begin
if ImageEnMView1.ImageCount = 0 then
TiffPageIndex := -1
else
TiffPageIndex := ImageEnMView1.SelectedImage;
tmrPreview.Enabled := False;
tmrPreview.Enabled := True;
end;
procedure TfrmConsCert.tmrPreviewTimer(Sender: TObject);
begin
tmrPreview.Enabled := False;
if TiffPageIndex < 0 then
image.Blank
else
begin
ImageEnMView1.CopyToIEBitmap( TiffPageIndex, image.IEBitmap );
image.Update;
end;
end;
//call to open the file
LoadTiffFile(arquivo.tif)
|
xequte |
Posted - Apr 10 2023 : 20:49:10 Was that LoadFromFileOnDemand with thumbnails (ImageEnMView1.StoreType := ietThumb)?
What is your code to fill the TImageEnMView with TIETIFFHandler?
Nigel Xequte Software www.imageen.com
|
AndNit |
Posted - Apr 10 2023 : 20:12:28 Hi,
yes, my files are big because they have many pages, usually more than 1,000 pages, and I can't change that. Before using TifHandler I used LoadFromFileOnDemand and I had a very significant improvement when switching to TifHandler |
xequte |
Posted - Apr 10 2023 : 17:21:52 Hi
Firstly, do your large TIFF files contain many small images, or just a few very large images?
Have you found the performance of TImageEnMView to be problematic when loading thumbnails on demand?
ImageEnMView1.StoreType := ietThumb; ImageEnMView1.LoadFromFileOnDemand( 'D:\MyTiff.tiff' );
http://www.imageen.com/help/TImageEnMView.LoadFromFileOnDemand.html
Nigel Xequte Software www.imageen.com
|
AndNit |
Posted - Apr 10 2023 : 12:33:55 hello, this time I'm really really lost. Could you introduce me, in practice, how I can, using TIFHandler (my tif files are very large 500mb and above) click on a thumbnail in TimageEnMView, open it in a TimageEnView, scribble this Image with the brush tool, update the thumbnail in TimageEnMView and then save everything using TIFHandler?
I am very grateful, I am not able to evolve in this solution. |
xequte |
Posted - Apr 08 2023 : 18:58:47 Hi
1. You should use ImageEnMView1.GetTIEBitmap to retrieve images for the TImageEnView, and then ImageEnMView1.ReleaseBitmap( i, True ) to update the TImageEnMView if the image changed:
http://www.imageen.com/help/TImageEnMView.GetTIEBitmap.html https://www.imageen.com/help/TImageEnMView.ReleaseBitmap.html
2. With TIETIFFHandler, you can delete the old image and then insert the new one using:
http://www.imageen.com/help/TIETIFFHandler.InsertPageAsImage.html
But in most cases TIETIFFHandler is not the right option for TIFF management (it's really only useful when working with huge TIFF files).
You are probably better just to load the TIFF directly into the TImageEnMView (ImageEnMView.MIO.LoadFromFileTIFF). Then if the image changes update the TImageEnMView (ReleaseBitmap) and save the changes to file using a temporary TImageEnIO:
http://www.imageen.com/help/TImageEnIO.ReplaceFileTIFF.html
Or if the TIFF is not large, just save the whole TImageEnMView content (ImageEnMView.MIO.SaveToFileTIFF).
Nigel Xequte Software www.imageen.com
|
|
|