ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search
 All Forums  ImageEn Library for Delphi, C++ and .Net  ImageEn and IEvolution Support Forum  TIFF BitsPerSample & SamplesPerPixel New Topic  Reply to Topic
Author  Topic

Netherlands
12 Posts

 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, 8SamplesPerPixel (1 Short): 4while the good files have:BitsPerSample (3 Short): 8, 8, 8SamplesPerPixel (1 Short): 3The only other obvious difference is the SubFileType parameter which is Page in the good files but Zero in the ImageEn generated files.

7376 Posts

 Posted - Nov 10 2022 :  14:40:20 HiYou 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.htmlNigel Xequte Softwarewww.imageen.com

Netherlands
12 Posts

 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, 8SamplesPerPixel 4You 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, 8SamplesPerPixel 4I 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

7376 Posts

 Posted - Nov 13 2022 :  21:31:42 HiYour 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 Softwarewww.imageen.com
Topic
 New Topic  Reply to Topic Jump To: Select Forum ImageEn Library for Delphi, C++ and .Net       ImageEn and IEvolution Support Forum  -------------------- Home Active Topics Frequently Asked Questions Member Information Search Page