anchor.diff:    if GDIPlusActive and (KindOfImage(Stream.Memory) = png) then
     begin
       try
  -      Path := StrAlloc(MAX_PATH);
  +      if not TempPathInited then
  +      begin
  +        GetTempPath(Max_Path, TempPath);
  +        TempPathInited := True;
  +      end;
  +      SetLength(Filename, Max_Path+1);
  +      GetTempFilename(TempPath, 'png', 0, PChar(Filename));
  +      SetLength(Filename, Pos(#0, Filename) - 1);
  +      F := TFileStream.Create(Filename, fmCreate, fmShareExclusive);
         try
  -        GetTempPath(Max_Path, Path);
  -        SetLength(Filename, Max_Path+1);
  -        GetTempFilename(Path, 'png', Unique, PChar(Filename));
  +        F.CopyFrom(Stream, Stream.Size);
         finally
  -        StrDispose(Path);
  +        F.Free;
         end;
  -      Inc(Unique);
  -      I := Pos(#0, Filename);
  -      SetLength(Filename, I - 1);
  -      AssignFile(F, Filename);
  -      ReWrite(F, 1);
  -      BlockWrite(F, Stream.Memory^, Stream.Size);
  -      CloseFile(F);
         Result := TgpImage.Create(Filename, True); {True because it's a temporary file}
         Transparent := NotTransp;
       except
  
positive.code:   end;
  end;
  
  var
    Unique: Integer = 183902;
  
  {----------------GetImageAndMaskFromStream}
  
  function GetImageAndMaskFromStream(Stream: TMemoryStream;
    var Transparent: Transparency; var AMask: TBitmap): TgpObject;
  {$IFNDEF NoGDIPlus}
  var
    Filename: string;
    Path: PChar;
    F: file;
    I: Integer;
    {$ENDIF !NoGDIPlus}
  begin
    Result := nil;
    AMask := nil;
    if not Assigned(Stream) or (Stream.Memory = nil) or (Stream.Size < 20) then
      Exit;
    Stream.Position := 0;
  
  
negative.code: begin
    Result := nil;
    AMask := nil;
    if not Assigned(Stream) or (Stream.Size < 20) then
      Exit;
    Stream.Position := 0;
    try
  