I am trying to convert a image (from url) to bitmap here the code i was using but its for using a image from your computer (file) Dim bmp As bitmap = bitmap.FromFile(TextBox1.Text) I entering a url instead of a file location but i get a URI error
I'm using RaphaelJS. The browser renders a chart for me (which is in VML as all my users are on IE). I want the user to be able to save this image and share it normally eg paste into an email, into powerpoint, into a document etc etc.
Problem is not many things can render VML. I can easily get the VML markup describing the image back to the server. All I want to do is convert it to some kind of more universal format eg PNG, BMP, GIFF, whatever which I can then allow the user to download. I've seen lots of people struggling with this. I would have thought the seeing as VML is Microsoft's proprietary SVG format they might have at least provided facilities within their own languages (C#,VB.net) to convert VML to bitmaps. (Incidentally I can't use PHP - I've seen a lot of people attempting to solve this with a PHP based solution)
i had drawed a graph by clicking a analyze button, however when i click it, it will go to a new screen. below is my coding:
[Code]....
below is the condition i want, when i click the button Analyze, the image (graph) is showed under the button with the header and template:
[Code]....
my current condition is when i click the button analyze, it will totaly display the graph only without the header and template as print screen below: how to change the coding to let the template and heaser showed together with the bar chart?
I have to save the webpage as image in my system folder. I am saving them using stream.....but the page is not displayed as Image....It opened only through browsers.
I m facing one problem which is related to Bitmap Image Actually My image is saved properly without iis server but when i run application on iis server then its give Exception "A generic error occurred in GDI+." I m using this code-
Byte[] bytes = (Byte[])ds.Tables[0].Rows[r][1]; MemoryStream memStream = new MemoryStream(); memStream.Write(bytes, 0, bytes.Length); System.Drawing.Bitmap origBMP = new System.Drawing.Bitmap(memStream); System.Drawing.Bitmap newBMP = new System.Drawing.Bitmap(origBMP, 100, 150); System.Drawing.Graphics objGra = System.Drawing.Graphics.FromImage(newBMP); objGra.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; objGra.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; origBMP.Dispose(); newBMP.Save(Server.MapPath("ImageUpload\" + r + ".Jpeg"), System.Drawing.Imaging.ImageFormat.Jpeg); //exception throw "A generic error occurred in GDI+." newBMP.Dispose(); objGra.Dispose();
I have a colorpicker.png file and track the pixel clicked in codebehind using GetPixel. Works like a charm, but I read that converting to a bitmap on the fly is rather heavy on the server. Therefore I saved my .png file as a .bmp as well, so that a converted file would already exist. However, I don't seem tobe able to just use the bitmap file, but need to create a new bitmap from the bitmap...
My question is: The code below works (I provide it here for those who might need it - simply add the code below to codebehind and this code in your aspx page <asp:ImageButton
also note that the image can be whatever you want - a photo or a screendump of a colorpicker from say Photoshop or VS; and note that it's wise to put everything you need in an updatepanel). Should I write something else in order to get smarter access to the bitmap?
Protected Sub cpRubrik_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles cpRubrik.Click tbUtseenderub.ForeColor = BytFarg(e.X, e.Y) End Sub Protected Function BytFarg(ByVal x As Integer, ByVal y As Integer) As Color Dim myBitmap As New Bitmap(Server.MapPath("~/img/colorpicker.bmp")) Dim clr As Color = myBitmap.GetPixel(x, y) Return clr End Function
how to convert both text and image together into an image. To clarify my question I can say if I have a text editor where I can add both text,image,audio or video player, how canI convert the whole texteditor.text (it gives me html code) to an image and save it in a file.
i need a image control, who is able to convert the binary image data into image automatically, i find one which is paid control by telerik, but i need a freeware of it.
I have an ASP.NET web form. This web form has an event handler that generates some HTML. This HTML is based on the time-of-day, that is why it is created in the event handler. Based on the time of day, an image is created programmatically via the following method:
private Bitmap GetImageForTime(DateTime time) { Bitmap bitmap = new Bitmap(); // Dynamically build the bitmap... return bitmap; }
want to call this method when the HTML is being generated. However, I do NOT want to write the image on the server. Instead, I would like to figure out a way to write it out along with the HTML. In a sense, I'm trying to accomplish the following:
protected void myLiteral_Load(object sender, EventArgs e) { string html = "<table><tr><td>"; html += GetImageForTime(DateTime.Now); // This is the problem because it's binary. html += "</td><td>"; html += GetWeatherHtmlText(); html += "</td></tr></table>"; myLiteral.Text = html; }
I'm trying to generate a bitmap off a WPF border. The whole thing sits in a asp.net app (server side of course) running .net 4.0. The problem is, that the generated image is, well, empty. Does anyone have an idea why? Here's the code.
public static byte[] Draw(int width, int height) { MemoryStream memoryStream = new MemoryStream(); Thread t = new Thread(delegate() { System.Windows.Controls.Border border = new System.Windows.Controls.Border() { Background = Brushes.Red, BorderBrush = Brushes.Green, CornerRadius = new System.Windows.CornerRadius(5), Width = width, Height = height }; border.ApplyTemplate(); RenderTargetBitmap renderTargetBitmap = new RenderTargetBitmap(width, height, 90, 90, PixelFormats.Pbgra32); renderTargetBitmap.Render(border); BitmapEncoder bitmapEncoder = new PngBitmapEncoder(); bitmapEncoder.Frames.Add(BitmapFrame.Create(renderTargetBitmap)); bitmapEncoder.Save(memoryStream); }); t.SetApartmentState(ApartmentState.STA); t.Start(); bool success = t.Join(5000); if (success) return memoryStream.ToArray(); else throw new Exception("Fail"); }
The result is quite bad, as I said the thing returns the image with the right width and height, but it's empty, so I guess I don't mess the thing up with the threading bit.
I am generating a System.Drawing.Bitmap on the fly in an ASP.NET Custom Web Server Control, and then I want to serve this bitmap as part of the WebResource, because I do not want to save it on the hosting computer. Is there a way to instruct ASP.NET to serve the generated System.Drawing.Bitmap as part of it's WebResource? (therefore making it an "Embedded Resource")
In ASP.NET C# I'm trying to save a bitmap image as an 16-color non-transparent grayscale image as either a PNG or GIF. I assume I have to create a palette and then somehow attach the palette to the image but not sure how to go about doing this. The source image is a 24-bit color Bitmap.
I am currently dynamically creating a bitmap and using the graphics object from the string from the bitmap to Draw a string on it like so.
System.Drawing.Graphics graph = System.Drawing.Graphics.FromImage(bmp); graph.DrawString(text, font, brush, new System.Drawing.Point(0, 0));
This returns a rectangle shaped bitmap with the string written straight across from left to right. I would like to also be able to draw the string in the shape of a rainbow. How can I do this?
how to convert both text and image together into an image. To clarify my question I can say if I have a text editor where I can add both text,image,audio or video player, how can I convert the whole texteditor.text (it gives me html code) to an image and save it in a file. I will be highly pleased with your answer.
in previously asked question answeres said they dont get what i want to do exactly so heres is the full code also i simply want that instead of a TABLESe i rendered an image( of the content ) on the page
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.IO; using System.Text; using System.Data; using System.Drawing; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { System.Web.UI.WebControls.Panel panelmain = new System.Web.UI.WebControls.Panel(); System.Web.UI.WebControls.Literal abc = new System.Web.UI.WebControls.Literal(); abc.Text = "as<br/>dasdas<br/>dasdad"; DataSet ds = new DataSet(); DataTable dt; DataRow dr; DataColumn idCoulumn; DataColumn nameCoulumn; dt = new DataTable(); idCoulumn = new DataColumn("ID", Type.GetType("System.Int32")); nameCoulumn = new DataColumn("Name", Type.GetType("System.String")); dt.Columns.Add(idCoulumn); dt.Columns.Add(nameCoulumn); dr = dt.NewRow(); dr["ID"] = 1; dr["Name"] = "Name1"; dt.Rows.Add(dr); dr = dt.NewRow(); dr["ID"] = 2;.............
I am generating an aspx page which then I need to convert to png and store it somewhere. A similiar situation with mine was asked before here but got still no response. I tried also the code that the Swapnil Fegade has asked but the code is looping continually making request to loading page and no conversion is actually being done.I found some solutions on the web also but they require WebBrowser control which i understood can be used in windows form but i am building a web project.
I like to convert html for example a table to and image and save as jpg.(what I mean is that a table displayed on web page, I only want to get that specific table and save as image) Is it possible using asp.net?
I need to convert a paragraph of text into an image. Converting the text into an image is no problem. I have the code to do that. But the text must be shown as a paragraph with each line centered. That is a problem!Currently I can convert the text into a left justified paragraph because there are carriage returns in the text string. I suppose it could be center justified with spaces in the string but it would be hard to calculate the required spaces. There must be an easier way.What I need is some way to format the text into a paragraph and then convert it back into a string, preserving spaces. This needs to be done in VB.NET for an ASP.NET web application