Thank you very much. I solved my problem.
And I decided to look deeper.
Original image is base64 encoded string, like this:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAABGdBTUEAAYagMeiWXwAAADRJREFUeJztwQENAAAAwqD3T20ON6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH4MdZQAAahQ8jkAAAAASUVORK5C/4I=
This image shown normally at Chrome (71.0.3578.10), Vivaldi (2.2.1388.34), InternetExplorer (11.0.9600).
But, Firefox (I test at 62.0 and 64.0) can't display it.
This image is a simple black square. And it can be open at:
- Adobe Photoshop 13.1.2;
- IrfanView 4.44;
- Inkscape 0.92;
- Paint.Net 4.0.17;
- MS Paint (Win7);
- MS Office 2016;
- LibreOffice (6.0.2.1);
and others.
Error at opened in:
- Lazarus;
- Delphi 7 (PNG Delphi by Gustavo Daud 1.545);
- Delphi 10.1;
- Firefox;
and others.
PNG Delphi library code contains this:
{$DEFINE CheckCRC} //Enables CRC checking
// ...
{Loads the chunk from a stream}
function TChunk.LoadFromStream(Stream: TStream; const ChunkName: TChunkName;
Size: Integer): Boolean;
var
CheckCRC: Cardinal;
{$IFDEF CheckCRC}RightCRC: Cardinal;{$ENDIF}
begin
//...
{Check if crc readed is valid}
{$IFDEF CheckCRC}
RightCRC := update_crc($ffffffff, @ChunkName[0], 4);
RightCRC := update_crc(RightCRC, fData, Size) xor $ffffffff;
Result := RightCRC = CheckCrc;
{Handle CRC error}
if not Result then
begin
{In case it coult not load chunk}
Owner.RaiseError(EPngInvalidCRC, EPngInvalidCRCText);
exit;
end
{$ELSE}Result := TRUE; {$ENDIF}
//...
// and in other methods
I propose to add a similar definition in the FCL (FPReadPNG.pp).