Page 1 of 1

Saving Image as PNG no transparency

Posted: Mon Jul 21, 2014 8:33 am
by 10047857
Hi

I am using the TeeSaveToPNG function to save a bar chart with 50% transparency, but when I looked at the saved PNG the transparency has all gone, and the bars are 100% solid. Surely I should get a WYSIWYG image of whats on the screen, or am I missing something?

Bruce.

Re: Saving Image as PNG no transparency

Posted: Mon Jul 21, 2014 12:55 pm
by 10047857
Hi

Strangely, although there is no transparency when saving an image as a PNG, you get a perfect copy with transparency if you copy to the clipboard.

Bruce.

Re: Saving Image as PNG no transparency

Posted: Tue Jul 22, 2014 11:05 am
by 10050769
Hello Bruce,
After doing many tests we can’t reproduce the problem you are experiencing using latest version of TeeChart Pro VCL/FMX 2014, build number 2014.11.1405, and code below:

Code: Select all

uses VCLTee.TeePNG, VCLTee.Series, VCLTee.TeExport;
procedure TForm1.FormShow(Sender: TObject);
begin
  Chart1.AddSeries(TBarSeries).FillSampleValues;
  Chart1.Gradient.Visible:=false;
  Chart1.Color := clNone;
  Chart1.Series[0].Transparency := 50;
  TeeSaveToPNG(Chart1, 'E:\tmp\Chart1Transparent.png');
end;
Could you tell us which version are you using?
Thanks in advance,

Re: Saving Image as PNG no transparency

Posted: Tue Jul 22, 2014 12:03 pm
by 10047857
Sandra

I am using TeeChart 9.20.

How do I check for the exact build number?

In my problem I am saving multiple images and the uploading them to my website and using a call like with a specific size:

Code: Select all

TeeSaveToPNG(Chart1,Path,1200,600)
And this fails, but if I don't specify the size and use the default size like in your example transparency works.

Code: Select all

TeeSaveToPNG(Chart1,Path)
It also fails if you use

Code: Select all

TeeSaveToJPEG
and specify a size.

Bruce.

Re: Saving Image as PNG no transparency

Posted: Wed Jul 23, 2014 8:54 am
by 10050769
Hello Bruce,

Thanks for your information.
How do I check for the exact build number?
To check the exact build number, the easiest way is next:

1.- Open your IDE, add Chart in the form and then do click on chart with right button and choose About TeeChart.
Also, I have checked again, the transparency problem you are experiencing with PNG and JPEG, and it doesn't appear for us using latest Teechart Pro VCL/FMX and code below:

Code: Select all

uses VCLTee.TeePNG, VCLTee.TeeJPEG, VCLTee.Series, VCLTee.TeExport;
procedure TForm1.FormShow(Sender: TObject);
begin
  Chart1.AddSeries(TBarSeries).FillSampleValues;
  Chart1.Gradient.Visible:=false;
  Chart1.Color := clNone;
  Chart1.Series[0].Transparency := 50;
  TeeSaveToPNG(Chart1, 'E:\tmp\Chart1Transparent.png',1200,600);
  TeeSaveToJPEG(Chart1,'E:\tmp\Chart1Transparent.jpeg',1200,600);
end;
I would like suggest you, if you doesn't use the latest version of TeeChart Pro VCL/FMX, download our trial version and check my code again. You can download the trial version from here.
Thanks in advance,

Re: Saving Image as PNG no transparency

Posted: Wed Jul 23, 2014 11:34 am
by 10047857
Sandra

Thanks for the advice, but it does look like that I am using the latest version of TeeChart,
Capture2.png
Capture2.png (9.8 KiB) Viewed 22066 times
and rather than screw up TeeChart on my new XE6 development system, I would rather wait until you release a full update. I say this because I did the same thing when I purchased TeeChart v8 for Delphi 2007 version a few years ago, and had all sorts of problems even though I was reassured that it wouldn't.

Do you have any idea when you are going to release an update?

Bruce.

Re: Saving Image as PNG no transparency

Posted: Thu Jul 24, 2014 9:44 am
by 10050769
Hello Bruce,

Thanks for your information. We can not reproduce your problem using latest version of Teechart Pro VCL/FMX 2014 for XE6 and the previous code we attached you. Could you confirm us that if you use my previous code you can reproduce the problem?
Also, we would very grateful if you can send us a simple project, where we can reproduce exactly the problem here because we can find a solution.

Sorry for the inconveniences the problem can cause you.

Thanks in advance,

Re: Saving Image as PNG no transparency

Posted: Thu Jul 24, 2014 12:34 pm
by 10047857
Sandra

This gets better I have added the code you supplied to a project:

Code: Select all

unit Main;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, VCLTee.Series, VCLTee.TeEngine, Vcl.ExtCtrls, VCLTee.TeeProcs, VCLTee.Chart,
  VCLTee.StatChar, Vcl.StdCtrls, VCLTee.TeePNG, VCLTee.TeExport;

type
  TfmMain = class(TForm)
    Chart1: TChart;
    procedure FormCreate(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fmMain: TfmMain;

implementation

{$R *.dfm}

procedure TfmMain.FormCreate(Sender: TObject);
begin
  Chart1.AddSeries(TBarSeries).FillSampleValues;
  Chart1.Gradient.Visible:=false;
  Chart1.Color := clNone;
  Chart1.Series[0].Transparency := 50;
  TeeSaveToPNG(Chart1, 'C:\Temp\Chart1Transparent.png');
end;

end.
The result did have transparent bars yes, but...
Chart1Transparent.png
Chart1Transparent.png (11.93 KiB) Viewed 22051 times
Is the version of TeeChart that I'm using the latest version or not (2014.11.140512)?

I installed XE6 the week before I added TeeChart 2014 on a Windows 7 PC.

Re: Saving Image as PNG no transparency

Posted: Thu Jul 24, 2014 12:46 pm
by 10047857
Shall I zip up the project and send it you?

Re: Saving Image as PNG no transparency

Posted: Thu Jul 24, 2014 3:45 pm
by 10050769
Hello Bruce,
Shall I zip up the project and send it you?
Yes, we would be very grateful if you will attach the project for us.

Thanks in advance,

Re: Saving Image as PNG no transparency

Posted: Thu Jul 24, 2014 4:09 pm
by 10047857
Hi

Here it is.
Steema.zip
Test Project
(90.84 KiB) Downloaded 1116 times
Bruce.

Re: Saving Image as PNG no transparency

Posted: Mon Jul 28, 2014 3:09 pm
by 10050769
Hello Metman,

Thanks for your project. We are investigating with the problem you experiencing and we try to give you a good answer in short time as possible.

Thanks in advance,