This is a migrated thread and some comments may be shown as answers.

JPG image file

9 Answers 286 Views
Barcode
This is a migrated thread and some comments may be shown as answers.
Joseph
Top achievements
Rank 1
Joseph asked on 29 May 2013, 07:54 AM
Hi guys,

 How can I generate a jpg image file from barcode?

Thanks
Joseph

9 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 29 May 2013, 08:56 AM
Hi,

Please try the following C# code.

C#:
System.Drawing.Image image = RadBarCode1.GetImage();
image.Save(filename, System.Drawing.Imaging.ImageFormat.Jpeg);

Thanks,
Shinu.
0
Joseph
Top achievements
Rank 1
answered on 30 May 2013, 08:54 AM
Got it. How can I specify the image size?
0
Shinu
Top achievements
Rank 2
answered on 30 May 2013, 09:12 AM
Hi,

The LineWidth (DotSize) set for the RadBarCode determines the return image size. Please check the following sample code.

C#:
barcode.LineWidth = 2;

Thanks,
Shinu.
0
Joseph
Top achievements
Rank 1
answered on 31 May 2013, 01:50 AM
Thanks for your reply Shinu.
Then I tried to set the generated image as the data value for the radbinaryimage and I am getting a type conversion error.

My C# code.
System.Drawing.Image image = RadBarCode1.GetImage();
image.Save(filename, System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] data;
using (MemoryStream m = new MemoryStream())
    {
        data = new byte[m.Length];
        m.Write(data, 0, data.Length);
    }
radbinaryimage1.DataValue=data;

What am I doing wrong?
0
Shinu
Top achievements
Rank 2
answered on 31 May 2013, 03:11 AM
Hi Joseph,

Please try the following C# code.

C#:
System.IO.MemoryStream stream1 = new System.IO.MemoryStream();
barcode1.GetImage().Save(stream1, System.Drawing.Imaging.ImageFormat.Jpeg);
RadBinaryImage1.DataValue = stream1.ToArray();

Thanks,
Shinu.
0
Joseph
Top achievements
Rank 1
answered on 05 Jun 2013, 06:35 AM
Thanks, I have some confusion regarding the version. Which is the version that I should specify? Or telerik version?
0
Shinu
Top achievements
Rank 2
answered on 05 Jun 2013, 06:43 AM
Hi Joseph,

The Version property holds an integer value, in the range from 1 to 40, representing the version which one desires to use. Usually, higher-version QR codes are used do accommodate larger amounts of data.

Thanks,
Shinu.
0
Sarah
Top achievements
Rank 1
answered on 21 May 2014, 08:48 AM
In addition to barcode image size and QR Code version, I have a question related to barcode quiet zone? Is there any suggestion for this.
0
Princy
Top achievements
Rank 2
answered on 21 May 2014, 11:43 AM
Hi Sarah,

EAN13 is a barcode symbology which encodes numbers into a series of bars. It is of fixed length, of 13 digit (12 data and 1 check), and accepts numbers. First digit is always placed outside the symbol; additionally a right quiet zone indicator (>) is used to indicate Quiet Zones that are necessary for barcode scanners to work properly. It includes a checksum. More information about RadBarcode properties could be found here and about different barcode types here.

Thanks ,
Princy.
Tags
Barcode
Asked by
Joseph
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Joseph
Top achievements
Rank 1
Sarah
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or