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 16bit gray scale
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

carlonarcisi

Italy
7 Posts

Posted - Feb 24 2017 :  03:41:16  Show Profile  Reply
I'm trying to convert an image TIFF 16Bit grayscale in TIFF 8bit grayscale. (image format destination would be any format .. )
I can show TIFF 16bit grayscale image with ImageJ program (https://imagej.nih.gov/ij/) and by imagej I have exported image in 8bit grayscale.
So I written the following command like you Nigel has suggested

ImageEnIO1.LoadFromFileTIFF('TIFF16.TIF');
ImageEnIO1.Params.BitsPerSample := 8;
ImageEnIO1.Params.SamplesPerPixel := 1;
ImageEnIO1.Params.SaveToFile('pippo.tif');

But file has nothing ..

what can I do ?


attach/carlonarcisi/201722433931_FOTO.zip
3158.66 KB

attach/carlonarcisi/201722434033_Source.zip
1.86 KB

w2m

USA
1990 Posts

Posted - Feb 24 2017 :  09:10:09  Show Profile  Reply
ImageEnIO1.LoadFromFileTIFF('TIFF16.TIF');
ImageEnIO1.Params.BitsPerSample := 8;
ImageEnIO1.Params.SamplesPerPixel := 1;
ImageEnIO1.SaveToFile('pippo.tif');

You have to save the image so use SaveToFile not Params.SavetoFile.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

carlonarcisi

Italy
7 Posts

Posted - Feb 25 2017 :  00:24:07  Show Profile  Reply
hello bill
you're right, I was wrong the way to save the image .. but the problem continues
"pippo.tiff" the file created is a black image.
I do not think it's enough to convert a 16-bit image grayscale to 8bit grayscale change BitsPerSample end SamplesPerPixel.
if I open TIFF16.TIF with ImageEn or by any other viewer I always get a black picture .. only if I use ImageJ or a viewer for medical images I see the file (I am attaching a screenshot)
To convert the image to an 8bit grayscale I did not want to install ImageJ to all my customers .. I hope the ImageEn could solve the problem

Carlo

Go to Top of Page

w2m

USA
1990 Posts

Posted - Feb 25 2017 :  10:55:48  Show Profile  Reply
 
ImageEnIO1.LoadFromFileTIFF('TIFF16.TIF');
But file has nothing ...


TIFF16.TIF appears to be a medical image in 16-bit grayscale.
ImageEn can read it but it's all black!

The image contains an invisible range of values.
To show the image you should adjust the visible range using ImageEnView.IEBitmap.BlackValue and WhiteValue. This is done automatically if you call AutoCalcBWValues():

The file TIFF16.TIF can be loaded and viewed with:
procedure TForm1.Open1Click(Sender: TObject);
begin
  if OpenImageEnDialog1.Execute then
  begin
    ImageEnView1.LegacyBitmap := False;
    ImageEnView1.IO.NativePixelFormat := True;
    ImageEnView1.IO.LoadFromFile(OpenImageEnDialog1.FileName);
    ImageEnView1.IEBitmap.AutoCalcBWValues;
  end;
end;

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

carlonarcisi

Italy
7 Posts

Posted - Feb 26 2017 :  09:04:24  Show Profile  Reply
GREAT !
It's work ! thanks too much
Carlo
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: