ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder
ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 MIO.NativePixelFormat

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Size 
UserName:
Password:
Mode 
Format  BoldItalicizedUnderline Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailBrowse for an image to attach to your post Browse for a zip to attach to your post Insert CodeInsert QuoteInsert List
   
Message 

 

Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
aleatprog Posted - Apr 07 2019 : 13:16:04
I need to open and save an 8 bit grey scale multipage TIF.


The following code should open the single images as 8 bit IEBitmap:

TImageEnMView.MIO.NativePixelFormat := True;
iPageCount := EnumTIFFIm(path);
for i := 0 to iPageCount - 1 do
TImageEnMView.AppendImage(path + IEM_Path_Index_Delimiter + IntToStr(i));


I added the following lines in order to check the pixel format:

bmp := TImageEnMView.GetTIEBitmap(0);
bit := bmp.BitCount;


bit value is 24, not 8. May you tell me what is missing in the code above?

Thanks,
Ale
3   L A T E S T    R E P L I E S    (Newest First)
aleatprog Posted - Apr 08 2019 : 08:55:29
Thank you, Nigel. I'll do some tests with ImageEnMView.MIO.Params[i].Read and ImageEnMView.MIO.LoadFromFileTIFF which I'd replaced with the current ImageEnMView.AppendImage.

Ale
xequte Posted - Apr 08 2019 : 01:44:25
Hi

When you use AppendImage, it does not use MIO, so NativePixelFormat is ignored. You can load like this instead:

ImageEnMView1.MIO.NativePixelFormat := True;
ImageEnMView1.MIO.Read( path );


Regarding your second part of code, firstly, ensure LockUpdate/UnlockUpdate are wrapped around the entirety of your code, e.g.


ImageEnMView1.LockUpdate();
for i := 0 to ImageEnMView1.MultiSelectedImagesCount - 1 do
begin
  bmp := ImageEnMView1.GetTIEBitmap(i);
  with TImageEnProc.CreateFromBitmap(bmp) do
  begin
    ConvertTo(ie8g);
    Free;
  end;
  ImageEnMView1.ReleaseBitmap(i, True);
  ImageEnMView1.MIO.Params[i].TIFF_Compression := ioTIFF_JPEG;
end;
ImageEnMView1.UnlockUpdate();
ImageEnMView1.MIO.SaveToFileTIFF(Path, True);


Secondly, try just setting:

bmp.PixelFormat := ie8g;

Otherwise, I'll need to check it when I am in the office tomorrow.


Nigel
Xequte Software
www.imageen.com
aleatprog Posted - Apr 07 2019 : 13:34:20
Part 2: The following code generates an 24bit instead of an 8bit TIFF:


for i := 0 to TImageEnMView.MultiSelectedImagesCount - 1 do
begin
  bmp := TImageEnMView.GetTIEBitmap(i);
  TImageEnMView.LockUpdate();
  with TImageEnProc.CreateFromBitmap(bmp) do
  begin
    ConvertTo(ie8g);
    Free;
  end;
  TImageEnMView.UnlockUpdate();
  TImageEnMView.ReleaseBitmap(i, True);
  TImageEnMView.MIO.Params[i].TIFF_Compression := ioTIFF_JPEG;
  TImageEnMView.MIO.SaveToFileTIFF(Path, True);
end;



What should be changed in order to create an 8bit TIFF?

Ale