Welcome, Guest
Username: Password: Remember me
Components and Libraries for Graphics Development, discussions, problems and suggestions.
  • Page:
  • 1

TOPIC:

How to get TPortableNetworkGraphic size? 11 years 8 months ago #2359

  • 4aiman
  • 4aiman's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • Comix creator
  • Posts: 227
  • Thank you received: 12
In my project I need to get the size of image somehow.
However, "size" is standing not for "width" & "height" but for "size of the graphical data".
For bitmap one probably wants to multiply height by width and then multiply the result by bpp value.
But png is compressed, so what should I do?

AFAIK, TPortableNetworkGraphic's predecessor is TFPImageBitmap. But I'm getting only garbage trying to work with png in the same way as I did with bitmaps.

Moreover, I want to save this graphical data in the dynamic array inside of record...
So, I have smth like this:
myrec=record
icon:TPrtableNetworkGraphic;
name:string[20];
ver:byte;
...
end;

then I have some variable, e.g.
pngs:array of myrec

and I want to save it via stream:
procedure TForm1.MenuItem5Click(Sender: TObject);
var s:tmemorystream; i,j:integer;
begin
     s:=TMemoryStream.Create;
     s.Write(Length(pngs),sizeof(longint); // size of array
     i:=1;
     s.Write(i,sizeof(byte)); // package version
     for i:= 0 to length(pngs) -1 do
         begin
              s.Write(pngs[i].name,20);
              s.Write(pngs[i].icon, ---=== WHAT SHOULD I USE AS PNG SIZE HERE??? ===---);
         end;
     s.SaveToFile('test.arch');
     s.Free;
end;

So, how can one define png size?
コンソールマニアック

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

  • Page:
  • 1