× CodeTyphon MacOS Development, discussions and problems

Question Image component and png

  • Peter Pohlmann
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
3 years 10 months ago #10136 by Peter Pohlmann
Image component and png was created by Peter Pohlmann
Hello guys and girls,

I have a problem with the Timage control on OS X mac.

I can not load and display png images in the control.

ElPicture:=TPicture.Create;
ElPicture.LoadFromFile(elhome+'desktop/main2.png');
Image2.assign(ElPicture);

Above does not show anything in the control.
Below the code works for jpgs

jpg:=TJPegImage.create;
jpg.LoadFromFile(elhome+'desktop/a.jpg');
Image1.Picture.Assign(jpg);

Any suggestions ?
Thanks
Peter

Please Log in or Create an account to join the conversation.

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
More
3 years 10 months ago - 3 years 10 months ago #10137 by Sternas Stefanos
Replied by Sternas Stefanos on topic Image component and png
Sir
try and this
...
  ElPicture:=TPicture.Create;
  if fileexists(elhome+'desktop/main2.png') then
  ElPicture.PNG.LoadFromFile(elhome+'desktop/main2.png');
...

PilotLogic Architect and Core Programmer
Last edit: 3 years 10 months ago by Sternas Stefanos.

Please Log in or Create an account to join the conversation.

  • Peter Pohlmann
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
3 years 10 months ago #10138 by Peter Pohlmann
Replied by Peter Pohlmann on topic Image component and png
Thanks for the reply.

Still no success. No image displayed. The file is ok and found,
but no picture is displayed from a png file.

ElPicture:=TPicture.Create;
if fileexists(elhome+'desktop/main2.png') then
begin
showmessage('found file');
ElPicture.PNG.LoadFromFile(elhome+'desktop/main2.png');
end;

Please Log in or Create an account to join the conversation.

  • Peter Pohlmann
  • Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
3 years 10 months ago #10139 by Peter Pohlmann
Replied by Peter Pohlmann on topic Image component and png
Alright I found the problem. Below the code works and shows the image.

PNG:=TPortableNetworkGraphic.Create ;
PNG.LoadFromFile(elhome+'desktop/main2.png');
Image2.Picture.PNG.Assign(PNG);

Thanks again and cheers
Peter

Please Log in or Create an account to join the conversation.

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
More
3 years 10 months ago #10140 by Sternas Stefanos
Replied by Sternas Stefanos on topic Image component and png
Thanks Sir
have fun

PilotLogic Architect and Core Programmer
The following user(s) said Thank You: Peter Pohlmann

Please Log in or Create an account to join the conversation.