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
 TIFF BitsPerSample & SamplesPerPixel

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

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
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
dwilbourn Posted - Nov 09 2022 : 07:23:38
I am generating TIFF files that are to be converted to GeoTIFFs using a separate command line utility (geoticp). This fails with with the TIFF files created with ImageEn, the error is always that the BitsPerSample are incorrect. This value is actually the same as the BitsPerSample in some good TIFFs from other sources, however the SamplesPerPixel are different so I presume that is the actual culprit. I have explicitly set both these parameters before saving the file and set AutoSetBitDepth to false but the saved files always have the same BitsperSample & SamplesPerPixel values.

How can I explicitly set these parameters? Are there any other parameters that would force values for these parameters?

I always get:
BitsPerSample (3 Short): 8, 8, 8
SamplesPerPixel (1 Short): 4

while the good files have:
BitsPerSample (3 Short): 8, 8, 8
SamplesPerPixel (1 Short): 3

The only other obvious difference is the SubFileType parameter which is Page in the good files but Zero in the ImageEn generated files.

3   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Nov 13 2022 : 21:31:42
Hi

Your source PNG has an alpha channel, so if you don't remove that then you will get 4 samples per pixel.

This works in my testing:

  ImageEnView1.IO.LoadFromFileAuto('d:\alpha.png');
  ImageEnView1.IEBitmap.RemoveAlphaChannel(True);
  ImageEnView1.IO.Params.TIFF_Compression := ioTIFF_Uncompressed;
  ImageEnView1.IO.Params.TIFF_PhotometInterpret := ioTIFF_RGB;
  ImageEnView1.IO.Params.BitsPerSample := 8;
  ImageEnView1.IO.Params.SamplesPerPixel := 3;
  ImageEnView1.IO.SaveToFile('d:\out.tiff');


Nigel
Xequte Software
www.imageen.com
dwilbourn Posted - Nov 10 2022 : 18:57:12
You can set the properties and they affect the image but the TIFF tags are still always reported as:
BitsPerSample 8, 8, 8
SamplesPerPixel 4

You can see this on the simple app I made, I set the BitsPerSample to 4 and SamplesPerPixel to 2 (just random numbers to see what happened). The generated TIFF file is obviously messed up but the TIFF Tag Viewer app reports:
BitsPerSample 8, 8, 8
SamplesPerPixel 4

I tried other random number combos and the image was usually messed up in some way but the tags are always the same.

The command line app I have to send these images to requires the TIFF tag SamplesPerPixel to be 3.


attach/dwilbourn/20221110184850_screen1.jpg
xequte Posted - Nov 10 2022 : 14:40:20
Hi

You can set those properties yourself, though they may be changed to make them compatible with the TIFF compression value that you are using.

Generally it is best to enable AutoSetBitDepth and let ImageEn take care of it for you:

https://www.imageen.com/help/TIEGlobalSettings.AutoSetBitDepth.html

Nigel
Xequte Software
www.imageen.com