久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何使用 C# 將 jpg 文件轉換為位圖?

How can I convert a jpg file into a bitmap, using C#?(如何使用 C# 將 jpg 文件轉換為位圖?)
本文介紹了如何使用 C# 將 jpg 文件轉換為位圖?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace convert
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load_1(object sender, EventArgs e)
        {
           // Image image = Image.FromFile(@"C:UsersPublicPicturesSample PicturesKoala.jpg");
            // Set the PictureBox image property to this image.
            // ... Then, adjust its height and width properties.
           // pictureBox1.Image = image;
            //pictureBox1.Height = image.Height;
            //pictureBox1.Width = image.Width;

            string strFileName = @"C:UsersPublicPicturesSample PicturesKoala.jpg";

            Bitmap bitmap = new Bitmap(strFileName);
            //bitmap.Save("testing.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
           pictureBox1.Image = bitmap;
           pictureBox1.Height = bitmap.Height;
           pictureBox1.Width = bitmap.Width;
        }

    }
}

我正在使用上面的代碼將 jpg 文件轉換為位圖.它有效,但我需要知道如何流式傳輸 jpg 圖像并將其轉換為位圖,然后顯示位圖圖像而不存儲它.我正在使用 c# 和 vb.net

I am using the above code for converting jpg file into bitmap. It works but I need to know how to stream the jpg image and convert it into bitmap then display the bitmap image with out storing it. I am using c# and vb.net

推薦答案

試試這個轉換為 Bitmap :

Try this to convert to Bitmap :

public Bitmap ConvertToBitmap(string fileName)
{
    Bitmap bitmap;
    using(Stream bmpStream = System.IO.File.Open(fileName, System.IO.FileMode.Open ))
    {
         Image image = Image.FromStream(bmpStream);

         bitmap = new Bitmap(image);

    }
    return bitmap;
}

這篇關于如何使用 C# 將 jpg 文件轉換為位圖?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Right-click on a Listbox in a Silverlight 4 app(右鍵單擊 Silverlight 4 應用程序中的列表框)
WPF c# webbrowser scrolls over top menu(WPF c# webbrowser 在頂部菜單上滾動)
C# Console app - How do I make an interactive menu?(C# 控制臺應用程序 - 如何制作交互式菜單?)
How to avoid duplicate form creation in .NET Windows Forms?(如何避免在 .NET Windows Forms 中創建重復的表單?)
UI Automation Control Desktop Application and Click on Menu Strip(UI自動化控制桌面應用程序并單擊菜單條)
Removing thin border around the menuitems(刪除菜單項周圍的細邊框)
主站蜘蛛池模板: 性欧美69 | 欧美在线视频免费观看 | 免费的一级片 | 在线成人免费视频 | 日韩欧美专区 | 久草福利在线观看 | 一区二区三区免费 | 夜夜嗨av一区二区三区 | 亚洲午夜精品 | 91精品国产99久久久久久红楼 | 欧美福利一区 | 一级特黄色片 | 黄色大片av | av免费不卡 | 成人免费小视频 | 国产深夜福利 | 国产欧美精品一区 | 四虎www| a一级黄色片 | 免费一级a毛片夜夜看 | 日韩精品视频免费在线观看 | 国产精品久久久久久久久久久久久久久 | 国产做爰视频免费播放 | 日韩精品在线免费观看 | 99视频| 成人动漫在线观看 | 日韩在线不卡视频 | 欧美性猛交一区二区三区精品 | 在线免费黄色 | 久久国产精品视频 | 久久精品一区二区国产 | 国产又粗又猛又黄又爽无遮挡 | 国产性生活 | 国产精品一区二区在线播放 | 99国产精品99久久久久久 | 久艹视频在线观看 | 亚洲成人免费av | 91插插插插插 | 九月丁香婷婷 | 精产国产伦理一二三区 | 在线亚洲一区 |