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