'how to resize a picture

I am using TDelphiZXingQRCode to generate QRCode in FMX. I have a problem when saving an image to BITMAP: image dimensions are always 29x29 I don't understand how to make a picture 100x100. I would be grateful if you help me. enter image description here

The problem is that QRCodeBitmap.SetSize(QRCode.Rows, QRCode.Columns);

QRCode.Rows and QRCode.Columns is 29

How to resize and trace the value Columns and Rows = 100?

I think, it's around here somewhere (in TDelphiZXingQRCode ) FElements := GenerateQRCode(FData, Ord(FEncoding)); FRows := Length(FElements) + FQuietZone * 2;



Solution 1:[1]

I would draw your bitmap from the QR code like this. This assumes that your QR code is square.

procedure TForm1.Button1click(Sender: Tobject);
const
  bmpSize : Integer = 100;
var
  QRCode: TDelphiZXingORCode; 
  Row, Column: Integer;
  Scale : Single;
begin
  QRCode := TDelphiZXingQRCode.Create;
  try
    QRCode.Data := edtText.Text;
    QRCode.Encoding := TQRCodeEncoding(cmbEncoding.ItemIndex);
    QRCode.QuietZone := StrToIntDef(edtQuietZone.Text, 4);
    QRCodeBitmap.SetSize(bmpSize, bmpSize);
    QRCodeBitmap.Clear(TAlphaColors.White);
    Scale := bmpSize / QRCode.Rows;
    for Row := 0 to QRCode.Rows - 1 do 
    begin
      for Column := 0 to QRCode.Columns - 1 do 
      begin
        if QRCode.IsBlack[Row, Column] then 
          QRCodeBitmap.ClearRect(TRectF.Create(PointF(Column, Row)*Scale, Scale, Scale), TAlphaColors.Black);
      end; 
    end;
  finally
    QRCode.Free;
  end;
  PaintBox1.Repaint;
end;

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 XylemFlow