473,408 Members | 1,845 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Generate image with WPF

Tem
I need to draw a black circle using WPF and generate an image file.
I used the following but it resulted in a blank file. I cannot figure out
what is wrong with it.

Thanks,
Tem

RenderTargetBitmap rtb = new RenderTargetBitmap(200, 200, 96, 96,
PixelFormats.Pbgra32);

Ellipse cir = new Ellipse();
cir.Height = 50;
cir.Width = 50;
cir.Stroke = Brushes.Black;
cir.StrokeThickness = 1.0;

rtb.Render(cir);

PngBitmapEncoder png = new PngBitmapEncoder();
png.Frames.Add(BitmapFrame.Create(rtb));
using (Stream fs= File.Create("test.png"))
{
png.Save(fs);
}

Oct 31 '07 #1
0 1161

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Rithish | last post by:
I have a set of images on a server. I want to pick these from the database without creating a temporary file on the server; and also have some text alongwith it. Something like, ...
12
by: jaapkramer | last post by:
I have a page with 641 images in it. Each image can be clicked with as result that the image source will be changed. For this the images need to have a unique ID. But to do this manually for 641 is...
4
by: Karthik Seetharaman | last post by:
I have to aspx pages default.aspx and imagegen.aspx default.aspx has an image webcontrol whose imageurl property is set to imagegen.aspx. imagegen.aspx generates a bitmap image and writes it to...
5
by: Popoxinhxan | last post by:
HI guy I am working on the web application that required to display the chart image on the page. The process is clicking the button and browser will popup another windows that displayed...
4
by: John.Arthur | last post by:
Hello, I need to create picture containing number that I will write in the picture. I need it to show it to the users of my application and they will write the number in a textBox, so this is to...
2
by: pei_world | last post by:
please help I have a function to generate bitmap object, however I don't want to save it to server. I want to display on the page directly. how to do it? this image is a verify image, so that for...
6
by: comp.lang.php | last post by:
/** * Generate the random security image * * @access public * @param $willUseFilePath (default false) boolean to determine if you will be using a file path * @param mixed $filePath (optional)...
12
by: Jim Michaels | last post by:
I need to generate 2 random numbers in rapid sequence from either PHP or mysql. I have not been able to do either. I get the same number back several times from PHP's mt_rand() and from mysql's...
4
by: e_matthes | last post by:
Hello everyone, I'm trying to make a class that will generate images. I can get it to work if the class and the instance of the class is in the same file. However, I can't get it to work if I...
1
by: pitchke | last post by:
Hey guys...i have developed a code to generate random text and i want to convert the resulting text into a image form...for reference..you people would have come this kind of images while registering...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.