Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6219695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:49:47+00:00 2026-05-24T07:49:47+00:00

I am using Barcode Studio 2011 to paint a QR Code into a Graphics32

  • 0

I am using Barcode Studio 2011 to paint a QR Code into a Graphics32 – TImage32 Component and I want to save it in png format but with the white colour as transparent this I have specified in the OuterColor of Graphics32.

OnFormCreate I have just

procedure TForm1.FormCreate(Sender: TObject);
begin
  psBarcodeComponent1.BarCode := 'some text here...';
end;

and for the moment I have the painting assigned to a Button Click Event

procedure TForm1.Button8Click(Sender: TObject); // Paint the barcode
var
  bmp: TBitmap32;
  Coords: TRect;
begin
 bmp := TBitmap32.Create;
 bmp.SetSize(image.Width, image.Height);
 bmp.Canvas.Brush.Color := color;
 bmp.Canvas.Rectangle(-1, -1, image.Width+2, image.Height+2);

 bmp.DrawMode := dmTransparent;
 bmp.OuterColor := clWhite;

 // make Coords the size of image
 Coords := Rect(0,0,image.Width,image.Height);
 psBarcodeComponent1.PaintBarCode(bmp.Canvas, Coords);
 image.Bitmap.Assign(bmp);
end;

I am using the Vampyre Imaging Library to convert the Bitmap into PNG Format but I will gladly use any library, function, and advice – I have been trying to do this now for nearly a week! I have read through and re-read the documentation of graphics32 and also of the Vampyre Imaging Library but nothing I try will convert the white to a transparent colour. I have tried clWhite, clWhite32 and also setting the drawMode to dmBlend and applying the ChromaKey Function all to no avail but plenty frustration, coffee and a little beer also 😉

This is how I am saving it…

procedure TForm1.Button7Click(Sender: TObject); // Save with Vampyre Imaging Lib
{ Try to save in PNG format with transparancy }
var
  FImage: TSingleImage;
begin
  FImage := TSingleImage.Create;
  ConvertBitmap32ToImage(image.Bitmap, FImage);
  FImage.SaveToFile('VampyreLibIMG.png');
end;  

This results in a Black coloured thumbnail and when viewed in Windows Photo Viewer it is completely transparent.

I hope that I have provided enough information and that someone is able to help me.

Chris

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T07:49:47+00:00Added an answer on May 24, 2026 at 7:49 am

    This approach works for me:

    uses GR32, GR32_PNG, GR32_PortableNetworkGraphic;
    
    var
      Y: Integer;
      X: Integer;
      Png: TPortableNetworkGraphic32;
    
      function IsWhite(Color32: TColor32): Boolean;
      begin
        Result:= (TColor32Entry(Color32).B = 255) and
                 (TColor32Entry(Color32).G = 255) and
                 (TColor32Entry(Color32).R = 255);
      end;
    
    begin
      with Image321 do
      begin
        Bitmap.ResetAlpha;
        for Y := 0 to Bitmap.Height-1 do
          for X := 0 to Bitmap.Width-1 do
          begin
            if IsWhite(Bitmap.Pixel[X, Y]) then
              Bitmap.Pixel[X,Y]:=Color32(255,255,255,0);
          end;
        Png:= TPortableNetworkGraphic32.Create;
        Png.Assign(Bitmap);
        Png.SaveToFile('C:\Temp\NowTransparent.png');
        Png.Free;
      end;
    end;
    

    This uses the GR32 PNG library. It’s a pretty direct way, setting all white pixels to transparent.

    PS: Image321 is a TImage32 component, containing my TBitmap32.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm able to save the captured image from a barcode scanner using this code:
i am using zxing for barcode reader into my iphone application .But it is
I am using ASP.NET and I want to create a barcode in a pdf
working with Flex4 AIR app, using this component I get data from the barcode
I am using zbarcam to read barcode from a webcam in my webapps. But,
I am using following code to invoke Barcode scanner apps from Zing public Button.OnClickListener
I am using zbar sdk in my project but it is not scanning barcode
I am using silverlight plugin for capturing images through webcam and want to save
I want to read barcode from barcode device using Java. Please guide me.
I am using redlaser sdk for scanning the barcode of products. I want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.