Welcome, Guest
Username: Password: Remember me
CodeTyphon MacOS Development, discussions and problems
  • Page:
  • 1

TOPIC:

Image component and png 8 years 1 week ago #10136

  • Peter Pohlmann
  • Peter Pohlmann's Avatar Topic Author
  • Visitor
  • Visitor
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.

Image component and png 8 years 1 week ago #10137

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4528
  • Thank you received: 1111
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

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

Last edit: by Sternas Stefanos.

Image component and png 8 years 1 week ago #10138

  • Peter Pohlmann
  • Peter Pohlmann's Avatar Topic Author
  • Visitor
  • Visitor
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.

Image component and png 8 years 1 week ago #10139

  • Peter Pohlmann
  • Peter Pohlmann's Avatar Topic Author
  • Visitor
  • Visitor
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.

Image component and png 8 years 1 week ago #10140

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
  • Posts: 4528
  • Thank you received: 1111
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.

  • Page:
  • 1