Author |
Topic |
|
andyhill
Australia
133 Posts |
Posted - Sep 04 2021 : 18:26:10
|
ColorPalette:= TIEColorPalette.Create(nil);
ie:= TImageEnView.Create(nil);
//ie.LegacyBitmap:= True;
ie.IO.NativePixelFormat:= True;
//ie.EnableAlphaChannel:= True;
ie.IO.LoadFromFilePng(UniServerModule.EXEDir+'temp\temp.png');
if ie.IEBitmap.PixelFormat <> ie8p then begin
ie.IEBitmap.PixelFormat:= ie8p; // FAILS TO CHANGE
end;
ColorPalette.AssignPalette(ie, False, True);
ie.IEBitmap.SetTransparentColors(clWhite, clWhite, 0);
ColorPalette.Free;
Please advise how to LoadFromFilePng, SaveToFilePng (8bit paleted with white transparent background) - thanks
I want to save ie to a PNG File with a White Transparent Background (8bit preferable but 24bit is OK too).
Andy |
|
xequte
38182 Posts |
Posted - Sep 06 2021 : 00:48:52
|
Hi Andy
Do you mean like this:
// Convert a 32bit PNG file to an 8bit PNG (without transparency)
ImageEnView1.IO.LoadFromFile( 'D:\Alpha.png');
// Remove alpha channel and make background white
ImageEnView1.IEBitmap.RemoveAlphaChannel( True, clWhite );
// Set PixelFormat to 8bit
ImageEnView1.IEBitmap.PixelFormat := ie8p;
// Use PixelFormat as authoritative source of bit-depth
IEGlobalSettings().AutoSetBitDepth := True;
ImageEnView1.IO.SaveToFile('D:\No-Alpha.png');
Nigel Xequte Software www.imageen.com
|
|
|
andyhill
Australia
133 Posts |
Posted - Sep 06 2021 : 01:10:36
|
I want Transparency.
When ever I resample (scale) I loose transparency.
Please show me how to load JPG/PNG file (assume 24bit) - Save as PNG file with transparency.
Jpg-24bit ---> Resample (downsize) ---> Png-8bit (with White Transparency).
Andy |
|
|
xequte
38182 Posts |
Posted - Sep 06 2021 : 03:54:46
|
Hi Andy
Only a 32bit PNG file supports alpha, so are you wanting to turn the white pixels transparent and then save as a transparent PNG?
Nigel Xequte Software www.imageen.com
|
|
|
andyhill
Australia
133 Posts |
Posted - Sep 06 2021 : 16:09:28
|
I use Corel PhotoPaint and it can make PNG Transparent Images on a few formats including 8bit Paleted ?
Andy |
|
|
xequte
38182 Posts |
Posted - Sep 06 2021 : 18:30:19
|
Hi Andy,
Sorry, to be clear only 32bit PNG (and 8bit grayscale PNG) support full alpha transparency.
8bit color PNG can support 1bit transparency (i.e. not alpha).
Though in my tests today, I encountered an issue with that, so we'll need to investigate further.
Nigel Xequte Software www.imageen.com
|
|
|
andyhill
Australia
133 Posts |
Posted - Sep 06 2021 : 19:48:56
|
I have had issues hence my posting so I am glad you have found something to fix :)
Andy |
|
|
andyhill
Australia
133 Posts |
Posted - Sep 06 2021 : 22:07:32
|
I have wrestled with this problem for a very long time ...
WHENEVER I use TImageEnView to ReSample a PNG Image the PNG Image Pallet (transparency color goes haywire) resulting in BLACK Image.
Please provide work around ASAP (it is urgent) - Thank You
Andy |
|
|
xequte
38182 Posts |
Posted - Sep 08 2021 : 04:11:22
|
Hi Andy
I used the code and source you sent. It produces a valid image for me.
What version of Delphi are you using?
Are you creating a 32bit or 64bit EXE? If 64bit, what is the value of:
IEGlobalSettings().ActivePngEngine();
Nigel Xequte Software www.imageen.com
|
|
|
andyhill
Australia
133 Posts |
Posted - Sep 08 2021 : 04:47:15
|
IEGlobalSettings().ActivePngEngine();
Does not work on its own, please show code as to how to implement and what to set it for 64bit applications ?.
Andy |
|
|
xequte
38182 Posts |
|
xequte
38182 Posts |
Posted - Oct 12 2021 : 22:37:39
|
We have fixed the issue of 8bit color PNG not supporting 1bit transparency.
Nigel Xequte Software www.imageen.com
|
|
|
|
Topic |
|