Saving Image as PNG no transparency

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Metman
Advanced
Posts: 113
Joined: Fri Dec 21, 2007 12:00 am

Saving Image as PNG no transparency

Post by Metman » Mon Jul 21, 2014 8:33 am

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.

Metman
Advanced
Posts: 113
Joined: Fri Dec 21, 2007 12:00 am

Re: Saving Image as PNG no transparency

Post by Metman » Mon Jul 21, 2014 12:55 pm

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.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Saving Image as PNG no transparency

Post by Sandra » Tue Jul 22, 2014 11:05 am

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,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Metman
Advanced
Posts: 113
Joined: Fri Dec 21, 2007 12:00 am

Re: Saving Image as PNG no transparency

Post by Metman » Tue Jul 22, 2014 12:03 pm

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.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Saving Image as PNG no transparency

Post by Sandra » Wed Jul 23, 2014 8:54 am

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,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Metman
Advanced
Posts: 113
Joined: Fri Dec 21, 2007 12:00 am

Re: Saving Image as PNG no transparency

Post by Metman » Wed Jul 23, 2014 11:34 am

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 22237 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.

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Saving Image as PNG no transparency

Post by Sandra » Thu Jul 24, 2014 9:44 am

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,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Metman
Advanced
Posts: 113
Joined: Fri Dec 21, 2007 12:00 am

Re: Saving Image as PNG no transparency

Post by Metman » Thu Jul 24, 2014 12:34 pm

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 22222 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.

Metman
Advanced
Posts: 113
Joined: Fri Dec 21, 2007 12:00 am

Re: Saving Image as PNG no transparency

Post by Metman » Thu Jul 24, 2014 12:46 pm

Shall I zip up the project and send it you?

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Saving Image as PNG no transparency

Post by Sandra » Thu Jul 24, 2014 3:45 pm

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,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Metman
Advanced
Posts: 113
Joined: Fri Dec 21, 2007 12:00 am

Re: Saving Image as PNG no transparency

Post by Metman » Thu Jul 24, 2014 4:09 pm

Hi

Here it is.
Steema.zip
Test Project
(90.84 KiB) Downloaded 1155 times
Bruce.
Attachments
Steema.zip
(90.84 KiB) Downloaded 897 times

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Saving Image as PNG no transparency

Post by Sandra » Mon Jul 28, 2014 3:09 pm

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,
Best Regards,
Sandra Pazos / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply