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
 Transparent TIFF (again...)
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

dwilbourn

Netherlands
17 Posts

Posted - Mar 01 2024 :  05:20:24  Show Profile  Reply
About 18 months ago we discussed transparent TIFFs and you provided a solution that (it seems) worked at the time. However I am no longer able to make transparent TIFFs with the code sample you gave then. Has something changed in the relevant code or am I just being stupid as usual?

(see https://www.imageen.com/ieforum/topic.asp?TOPIC_ID=5501 for the original)

xequte

38608 Posts

Posted - Mar 02 2024 :  20:18:28  Show Profile  Reply
Hi

This code works for me:

// Save a PNG with alpha to TIFF
ImageEnView1.IO.LoadFromFile( 'D:\Alpha.png' );
ImageEnView1.IEBitmap.PixelFormat             := ie24RGB;
ImageEnView1.IO.Params.TIFF_PhotometInterpret := ioTIFF_RGB;
ImageEnView1.IO.Params.SamplesPerPixel        := 4;
ImageEnView1.IO.Params.BitsPerSample          := 8;
ImageEnView1.IO.Params.TIFF_Compression       := ioTIFF_UNCOMPRESSED;
ImageEnView1.IO.SaveToFile( 'D:\Alpha.TIFF' );

Can you show me your code and your source image.


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

dwilbourn

Netherlands
17 Posts

Posted - Mar 03 2024 :  10:15:43  Show Profile  Reply
Hi Nigel,
That is the code you suggested last time - and which I think must have worked then. It does not seem to work now. It does produce a TIFF file but nothing (I have tried) can read the file. Most programs just give a general file read error but IMDisplay (part of ImageMagick) is a bit more helpful, that says "Incorrect count for 'BitsPerSample'". I tried messing about with the BitsPerSample parameter but that just raised more errors when trying to create the TIFF in ImageEn.
My sample code & image are attached.
Go to Top of Page

xequte

38608 Posts

Posted - Mar 03 2024 :  16:05:07  Show Profile  Reply
Hi

Nothing was attached.

Here is an example I created with the code above. It works correctly in the apps I test it with (Windows Photos, Paint.net, etc).

attach/xequte/20243316447_Alpha.TIFF

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

dwilbourn

Netherlands
17 Posts

Posted - Mar 03 2024 :  18:59:52  Show Profile  Reply
Try again....

attach/dwilbourn/202433185937_example1.zip
85.64 KB
Go to Top of Page

dwilbourn

Netherlands
17 Posts

Posted - Mar 03 2024 :  20:11:34  Show Profile  Reply
.... tested both your Alpha image and a number on images I created using the suggested code. They do open with transparency in Paint.net and FastStone Image viewer but those are the only programs or viewers I can find that do. All the rest (3 programs and at least 3 online viewers) just reject them as invalid files. I also validated the files using exiftool and they pass that so it would appear they are valid it's just that very few programs support transparency. Certainly none of the mainstream image programs I use do!

Looks like I need to put a *lot* of comments in my code to stop bothering you again about this!
Go to Top of Page

xequte

38608 Posts

Posted - Mar 03 2024 :  20:32:06  Show Profile  Reply
It does not surprise me that most applications do not support transparent TIFF, as very few developers would be aware that TIFF even is able to support transparency. Are you aware of any image viewers that support other transparent TIFF files, but not ones created in ImageEn?



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

dwilbourn

Netherlands
17 Posts

Posted - Mar 04 2024 :  03:00:39  Show Profile  Reply
No, just customers that say "I need transparent TIFFs!"
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: