Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to save picture and text into jpeg
    primarykey
    data
    text
    <p>When I press the save button I can save only the text not the image in the JPEG format.</p> <p><strong>Html:</strong></p> <pre><code> &lt;div id="painter" runat="server" style="left: 280px; position: absolute; top: 82px; width: 311px; height: 388px; background-color: #ccccff;"&gt; hi niladri &lt;br /&gt; helo &lt;br /&gt; dvshfgjfhglkglkhjlhkjmlkhklfhfg sasasasa &lt;br /&gt; sssdsdsds &lt;img src="image/1.jpg" alt="Osr" height="100" width="309" /&gt; &lt;/div&gt; &lt;asp:Button ID="Save" runat="server" Style="left: 733px; position: absolute; top: 266px" Text="Button" OnClick="Save_Click" /&gt; </code></pre> <p><strong>C# code:</strong></p> <pre><code> public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Save_Click(object sender, EventArgs e) { string[] value = painter.Style.Value.Split(';'); string hw = painter.InnerHtml; hw = hw.Replace("&lt;br /&gt;", Environment.NewLine); string width = value[3]; string height = value[4]; string bgcolor = value[5]; string[] widthArray = width.Split(':'); string[] heightArray = height.Split(':'); string[] bgcolorArray = bgcolor.Split(':'); int w = int.Parse(widthArray[1].Replace("px", "")); int h = int.Parse(heightArray[1].Replace("px", "")); string color = bgcolorArray[1]; //var overlay = new Bitmap(imagePath2); System.Drawing.Color c = System.Drawing.Color.Cyan;//.FromName("#ccccff"); System.Drawing.Bitmap bt = new System.Drawing.Bitmap(w, h); System.Drawing.Graphics oGraphics = System.Drawing.Graphics.FromImage(bt); System.Drawing.Brush brush = new System.Drawing.SolidBrush(c); oGraphics.FillRectangle(brush, 0, 0, w, h); oGraphics.DrawString(hw, new Font("Arial", 12, FontStyle.Italic), SystemBrushes.WindowText, new PointF(50, 50)); bt.Save("E:\\image10.jpg", System.Drawing.Imaging.ImageFormat.Jpeg); } } </code></pre> <p><strong>Image:</strong></p> <p><img src="https://i.stack.imgur.com/9A5IP.jpg" alt=""></p> <p>Here in the attached Jpeg image, we get only the html image source information not the original image when we save into jpeg format.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload