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
 ie32f. Save to 32bit Tiff Image
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

supersk

26 Posts

Posted - Dec 18 2018 :  04:36:08  Show Profile  Reply
I used the following code to generate a 32bit tiff image file:
imgtmp->IEBitmap->PixelFormat = ie32f;
imgtmp->IEBitmap->Height = RImage->GetHeight();
imgtmp->IEBitmap->Width = RImage->GetWidth();
imgtmp->IO->Params->BitsPerSample = 32;
imgtmp->IO->Params->SamplesPerPixel = 1;

//Generate 32bit TIFF
float *P32;
for (int i = 0; i <= imgtmp->IEBitmap->Height - 1; i++) {
P32 = (float*)imgtmp->IEBitmap->Scanline[i];
for (int j = 0; j <= imgtmp->IEBitmap->Width - 1; j++) {
P32[j] = RImage->fData[i][j]/255.0;
}
}
imgtmp->IO->SaveToFileTIFF(DstFile);

Result: Only generate a 174Byte file, How can I do#65311; Thanks a lot.

xequte

4547 Posts

Posted - Dec 18 2018 :  21:26:41  Show Profile  Reply
Hi

What is your value for:

imgtmp->IO->Params->TIFF_Compression

https://www.imageen.com/help/ImageEn/TIOParams.TIFF_Compression.html


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

supersk

26 Posts

Posted - Dec 19 2018 :  02:20:37  Show Profile  Reply
I Add the params as following, but it doesn't work:
imgtmp->LegacyBitmap = false; // Do not use TBitmap
imgtmp->IEBitmap->PixelFormat = ie32f;
imgtmp->IEBitmap->Height = RImage->GetHeight();
imgtmp->IEBitmap->Width = RImage->GetWidth();

imgtmp->IO->NativePixelFormat = true; // Use the original pixel format
imgtmp->IO->Params->BitsPerSample = 32;
imgtmp->IO->Params->SamplesPerPixel = 1;
imgtmp->IO->Params->TIFF_Compression = ioTIFF_UNCOMPRESSED;


//#29983;#25104;32#20301;TIFF#22270;
float *P32;
for (int i = 0; i <= imgtmp->IEBitmap->Height - 1; i++) {
P32 = (float*)imgtmp->IEBitmap->Scanline[i];
for (int j = 0; j <= imgtmp->IEBitmap->Width - 1; j++) {
P32[j] = RImage->fData[i][j]/255.0;
}
}
imgtmp->IO->SaveToFileTIFF(DstFile);

and I use the following code to generate 16bit tiff image, it work!
imgtmp->IEBitmap->PixelFormat = ie16g;
imgtmp->IEBitmap->Height = RImage->GetHeight();
imgtmp->IEBitmap->Width = RImage->GetWidth();
imgtmp->IO->Params->BitsPerSample = 16;
imgtmp->IO->Params->SamplesPerPixel = 1;

//16#20301;TIFF#22270;
WORD *P16;
double constscale = 65536.0/255.0;
for (int i = 0; i <= imgtmp->IEBitmap->Height - 1; i++) {
P16 = (WORD*)imgtmp->IEBitmap->Scanline[i];
for (int j = 0; j <= imgtmp->IEBitmap->Width - 1; j++) {
P16[j] = RImage->fData[i][j]*constscale;
}
}
imgtmp->IO->SaveToFileTIFF(DstFile);
Why?
Go to Top of Page

xequte

4547 Posts

Posted - Dec 21 2018 :  04:20:12  Show Profile  Reply
Hi

The current version of ImageEn does not support ie32f, but we have just added it. Please email me for a pre-release.

You can save to save ie32f pixel format as follows:

  imageenview.LegacyBitmap := false;
  imageenview.IEBitmap.PixelFormat := ie32f;
  imageenview.IO.Params.BitsPerSample := 32;
  imageenview.IO.Params.SamplesPerPixel := 1;
  imageenview.IO.Params.TIFF_PhotometInterpret := ioTIFF_BLACKISZERO;
  imageenview.IO.params.TIFF_Compression := ioTIFF_UNCOMPRESSED;
  imageenview.IO.SaveToFile('test.tiff');

Note: TIFF_Compression must be ioTIFF_UNCOMPRESSED, ioTIFF_LZW, ioTIFF_PACKBITS or ioTIFF_ZIP


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