怎么利用C#创建透明的GIF图片?(可自定义调色板),收藏一下.

在C#窗体中,如何设置动态背景,如何图上的label等其他控件背景设为透明 1.创建窗体,从工具箱中上找到pictureBox,再将pictureBox拉至你所需要的大小 2.点击pictureBox,找到其属性image,点击导入本地资源,再找到你所需要设置的背景GIF动图 完成1、2步骤,动态背景已经设置好啦!接下来我们来设置动态背景图上的控件 如果我们需要设置登录账号和密码,直接拖动控件会变成以下样子 这样就会显得不美观,那我们应该怎么去做呢? 3.双击Form1登录窗体,写下以下代码,就会让控件的背景透明 ... 阅读详情

http://www.realworldasp.net/article.asp?article=142

using System;
using System.IO;
using System.Drawing;
using System.Drawing.Imaging;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
 
namespace TransparentGifCreator
{
  /// <summary>
  /// Summary description for Form1.
  /// </summary>
  public class Form1 : System.Windows.Forms.Form
  {
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.ComponentModel.IContainer components;
 
Image _gifImage;
private System.Windows.Forms.Timer timer1;
ColorPalette cp;
int CurrentEntry;
 
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
 
//
// TODO: Add any constructor code after InitializeComponent call
//
}
 
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
 
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.panel1 = new System.Windows.Forms.Panel();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.Location = new System.Drawing.Point(96, 8);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(144, 144);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// panel1
//
this.panel1.Location = new System.Drawing.Point(8, 168);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(144, 144);
this.panel1.TabIndex = 1;
this.panel1.Click += new System.EventHandler(this.panel1_Click);
this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint);
this.panel1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseMove);
//
// button1
//
this.button1.Location = new System.Drawing.Point(200, 176);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(88, 24);
this.button1.TabIndex = 2;
this.button1.Text = "Open";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(200, 216);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(88, 24);
this.button2.TabIndex = 2;
this.button2.Text = "Save";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(200, 256);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(88, 24);
this.button3.TabIndex = 2;
this.button3.Text = "Exit";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// timer1
//
this.timer1.Enabled = true;
this.timer1.Interval = 250;
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(328, 325);
this.Controls.Add(this.button1);
this.Controls.Add(this.panel1);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button3);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
 
}
#endregion
 
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
 
private void panel1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
if(cp==null)
return;
 
for(float y=0;y<16;y++)
for(float x=0;x<16;x++)
{
Color c=Color.Black;
if( ((16*y) + x)<cp.Entries.Length)
c=cp.Entries[(int)((16*y)+x)];
SolidBrush sb=new SolidBrush(Color.FromArgb(255,c));
float w=((float)this.panel1.Width)/16;
float h=((float)this.panel1.Height)/16;
e.Graphics.FillRectangle(sb,w*x,h*y,w,h);
if(c.A!=255)
{
if(showTrans)
e.Graphics.DrawRectangle(Pens.Black,w*x,h*y,w-1,h-1);
else
e.Graphics.DrawRectangle(Pens.White,w*x,h*y,w-1,h-1);
}
 
sb.Dispose();
}
}
 
 
private void panel1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
int y=(int)(((float)e.Y)/(((float)this.panel1.Width)/16f));
int x=(int)(((float)e.X)/(((float)this.panel1.Height)/16f));
CurrentEntry=(int)((16*y)+x);
if(cp!=null)
{
if(CurrentEntry>=cp.Entries.Length)
CurrentEntry=cp.Entries.Length-1;
//Little bit of diagnostic for the palette chooser below
//System.Diagnostics.Trace.WriteLine(string.Format("{0},{1}, adjusted={4},{5} entry={2} Colour={3}",e.X,e.Y,CurrentEntry,cp.Entries[CurrentEntry].ToString(),x,y));
}
}
 
private void panel1_Click(object sender, System.EventArgs e)
{
//Creates a new GIF image with a modified colour palette
if(cp!=null)
{
//Create a new 8 bit per pixel image
Bitmap bm=new Bitmap(_gifImage.Width,_gifImage.Height,PixelFormat.Format8bppIndexed);
//get it's palette
ColorPalette ncp=bm.Palette;
 
//copy all the entries from the old palette removing any transparency
int n=0;
foreach(Color c in cp.Entries)
ncp.Entries[n++]=Color.FromArgb(255,c);
 
//Set the newly selected transparency
ncp.Entries[CurrentEntry]=Color.FromArgb(0,cp.Entries[CurrentEntry]);
//re-insert the palette
bm.Palette=ncp;
 
//now to copy the actual bitmap data
//lock the source and destination bits
BitmapData src=((Bitmap)_gifImage).LockBits(new Rectangle(0,0,_gifImage.Width,_gifImage.Height),ImageLockMode.ReadOnly,_gifImage.PixelFormat);
BitmapData dst=bm.LockBits(new Rectangle(0,0,bm.Width,bm.Height),ImageLockMode.WriteOnly,bm.PixelFormat);
 
//uses pointers so we need unsafe code.
//the project is also compiled with /unsafe
unsafe
{
//steps through each pixel
for(int y=0;y<_gifImage.Height;y++)
for(int x=0;x<_gifImage.Width;x++)
{
//transferring the bytes
((byte *)dst.Scan0.ToPointer())[(dst.Stride*y)+x]=((byte *)src.Scan0.ToPointer())[(src.Stride*y)+x];
}
}
 
//all done, unlock the bitmaps
((Bitmap)_gifImage).UnlockBits(src);
bm.UnlockBits(dst);
 
//clear out the picturebox
this.pictureBox1.Image=null;
_gifImage.Dispose();
//set the new image in place
_gifImage=bm;
cp=_gifImage.Palette;
this.pictureBox1.Image=_gifImage;
}
}
 
private void button1_Click(object sender, System.EventArgs e)
{
OpenFileDialog dlg=new OpenFileDialog();
dlg.Filter="GIF files|*.GIF";
if(dlg.ShowDialog()==DialogResult.OK)
{
_gifImage=Image.FromFile(dlg.FileName);
this.pictureBox1.Image=_gifImage;
cp=_gifImage.Palette;
this.panel1.Invalidate();
}
}
 
private void button2_Click(object sender, System.EventArgs e)
{
SaveFileDialog dlg=new SaveFileDialog();
dlg.Filter="GIF files|*.gif";
dlg.DefaultExt=".gif";
dlg.AddExtension=true;
if(dlg.ShowDialog()==DialogResult.OK)
{
_gifImage.Save(dlg.FileName,ImageFormat.Gif);
}
}
 
private void button3_Click(object sender, System.EventArgs e)
{
Application.Exit();
}
 
bool showTrans;
 
private void timer1_Tick(object sender, System.EventArgs e)
{
showTrans^=true;
Graphics g=this.panel1.CreateGraphics();
//I do this rather than invalidate the panel because
//the panel draws its background ans so flickers horribly.
PaintEventArgs pe=new PaintEventArgs(g,new Rectangle(0,0,this.panel1.Width,this.panel1.Height));
this.panel1_Paint(this,pe);
g.Dispose();
}
  }
} 
 -----------------------------------

using System;

using System.IO;

using System.Drawing;

using System.Drawing.Imaging;

using System.Collections;

using System.ComponentModel;

using System.Windows.Forms;

using System.Data;

 

namespace TransparentGifCreator

{

  /// <summary>

  /// Summary description for Form1.

  /// </summary>

  public class Form1 : System.Windows.Forms.Form

  {

    private System.Windows.Forms.PictureBox pictureBox1;

    private System.Windows.Forms.Panel panel1;

    private System.Windows.Forms.Button button1;

    private System.Windows.Forms.Button button2;

    private System.Windows.Forms.Button button3;

    private System.ComponentModel.IContainer components;

 

    Image _gifImage;

    private System.Windows.Forms.Timer timer1;

    ColorPalette cp;

    int CurrentEntry;

 

    public Form1()

    {

      //

      // Required for Windows Form Designer support

      //

      InitializeComponent();

 

      //

      // TODO: Add any constructor code after InitializeComponent call

      //

    }

 

    /// <summary>

    /// Clean up any resources being used.

    /// </summary>

    protected override void Dispose( bool disposing )

    {

      if( disposing )

      {

        if (components != null)

        {

          components.Dispose();

        }

      }

      base.Dispose( disposing );

    }

 

    #region Windows Form Designer generated code

    /// <summary>

    /// Required method for Designer support - do not modify

    /// the contents of this method with the code editor.

    /// </summary>

    private void InitializeComponent()

    {

      this.components = new System.ComponentModel.Container();

      this.pictureBox1 = new System.Windows.Forms.PictureBox();

      this.panel1 = new System.Windows.Forms.Panel();

      this.button1 = new System.Windows.Forms.Button();

      this.button2 = new System.Windows.Forms.Button();

      this.button3 = new System.Windows.Forms.Button();

      this.timer1 = new System.Windows.Forms.Timer(this.components);

      this.SuspendLayout();

      //

      // pictureBox1

      //

      this.pictureBox1.Location = new System.Drawing.Point(96, 8);

      this.pictureBox1.Name = "pictureBox1";

      this.pictureBox1.Size = new System.Drawing.Size(144, 144);

      this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;

      this.pictureBox1.TabIndex = 0;

      this.pictureBox1.TabStop = false;

      //

      // panel1

      //

      this.panel1.Location = new System.Drawing.Point(8, 168);

      this.panel1.Name = "panel1";

      this.panel1.Size = new System.Drawing.Size(144, 144);

      this.panel1.TabIndex = 1;

      this.panel1.Click += new System.EventHandler(this.panel1_Click);

      this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint);

      this.panel1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel1_MouseMove);

      //

      // button1

      //

      this.button1.Location = new System.Drawing.Point(200, 176);

      this.button1.Name = "button1";

      this.button1.Size = new System.Drawing.Size(88, 24);

      this.button1.TabIndex = 2;

      this.button1.Text = "Open";

      this.button1.Click += new System.EventHandler(this.button1_Click);

      //

      // button2

      //

      this.button2.Location = new System.Drawing.Point(200, 216);

      this.button2.Name = "button2";

      this.button2.Size = new System.Drawing.Size(88, 24);

      this.button2.TabIndex = 2;

      this.button2.Text = "Save";

      this.button2.Click += new System.EventHandler(this.button2_Click);

      //

      // button3

      //

      this.button3.Location = new System.Drawing.Point(200, 256);

      this.button3.Name = "button3";

      this.button3.Size = new System.Drawing.Size(88, 24);

      this.button3.TabIndex = 2;

      this.button3.Text = "Exit";

      this.button3.Click += new System.EventHandler(this.button3_Click);

      //

      // timer1

      //

      this.timer1.Enabled = true;

      this.timer1.Interval = 250;

      this.timer1.Tick += new System.EventHandler(this.timer1_Tick);

      //

      // Form1

      //

      this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);

      this.ClientSize = new System.Drawing.Size(328, 325);

      this.Controls.Add(this.button1);

      this.Controls.Add(this.panel1);

      this.Controls.Add(this.pictureBox1);

      this.Controls.Add(this.button2);

      this.Controls.Add(this.button3);

      this.Name = "Form1";

      this.Text = "Form1";

      this.ResumeLayout(false);

 

    }

    #endregion

 

    /// <summary>

    /// The main entry point for the application.

    /// </summary>

    [STAThread]

    static void Main()

    {

      Application.Run(new Form1());

    }

 

    private void panel1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)

    {

      if(cp==null)

        return;

 

      for(float y=0;y<16;y++)

        for(float x=0;x<16;x++)

        {

          Color c=Color.Black;

          if( ((16*y) + x)<cp.Entries.Length)

            c=cp.Entries[(int)((16*y)+x)];

          SolidBrush sb=new SolidBrush(Color.FromArgb(255,c));

          float w=((float)this.panel1.Width)/16;

          float h=((float)this.panel1.Height)/16;

          e.Graphics.FillRectangle(sb,w*x,h*y,w,h);

          if(c.A!=255)

          {

            if(showTrans)

              e.Graphics.DrawRectangle(Pens.Black,w*x,h*y,w-1,h-1);

            else

              e.Graphics.DrawRectangle(Pens.White,w*x,h*y,w-1,h-1);

          }

 

          sb.Dispose();

        }

    }

 

 

    private void panel1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)

    {

      int y=(int)(((float)e.Y)/(((float)this.panel1.Width)/16f));

      int x=(int)(((float)e.X)/(((float)this.panel1.Height)/16f));

      CurrentEntry=(int)((16*y)+x);

      if(cp!=null)

      {

        if(CurrentEntry>=cp.Entries.Length)

          CurrentEntry=cp.Entries.Length-1;

        //Little bit of diagnostic for the palette chooser below

        //System.Diagnostics.Trace.WriteLine(string.Format("{0},{1}, adjusted={4},{5} entry={2} Colour={3}",e.X,e.Y,CurrentEntry,cp.Entries[CurrentEntry].ToString(),x,y));

      }

    }

 

    private void panel1_Click(object sender, System.EventArgs e)

    {

      //Creates a new GIF image with a modified colour palette

      if(cp!=null)

      {

        //Create a new 8 bit per pixel image

        Bitmap bm=new Bitmap(_gifImage.Width,_gifImage.Height,PixelFormat.Format8bppIndexed);

        //get it's palette

        ColorPalette ncp=bm.Palette;

 

        //copy all the entries from the old palette removing any transparency

        int n=0;

        foreach(Color c in cp.Entries)

          ncp.Entries[n++]=Color.FromArgb(255,c);

 

        //Set the newly selected transparency

        ncp.Entries[CurrentEntry]=Color.FromArgb(0,cp.Entries[CurrentEntry]);

        //re-insert the palette

        bm.Palette=ncp;

 

        //now to copy the actual bitmap data

        //lock the source and destination bits

        BitmapData src=((Bitmap)_gifImage).LockBits(new Rectangle(0,0,_gifImage.Width,_gifImage.Height),ImageLockMode.ReadOnly,_gifImage.PixelFormat);

        BitmapData dst=bm.LockBits(new Rectangle(0,0,bm.Width,bm.Height),ImageLockMode.WriteOnly,bm.PixelFormat);

 

        //uses pointers so we need unsafe code.

        //the project is also compiled with /unsafe

        unsafe

        {

          //steps through each pixel

          for(int y=0;y<_gifImage.Height;y++)

            for(int x=0;x<_gifImage.Width;x++)

            {

              //transferring the bytes

              ((byte *)dst.Scan0.ToPointer())[(dst.Stride*y)+x]=((byte *)src.Scan0.ToPointer())[(src.Stride*y)+x];

            }

        }

 

        //all done, unlock the bitmaps

        ((Bitmap)_gifImage).UnlockBits(src);

        bm.UnlockBits(dst);

 

        //clear out the picturebox

        this.pictureBox1.Image=null;

        _gifImage.Dispose();

        //set the new image in place

        _gifImage=bm;

        cp=_gifImage.Palette;

        this.pictureBox1.Image=_gifImage;

      }

    }

 

    private void button1_Click(object sender, System.EventArgs e)

    {

      OpenFileDialog dlg=new OpenFileDialog();

      dlg.Filter="GIF files|*.GIF";

      if(dlg.ShowDialog()==DialogResult.OK)

      {

        _gifImage=Image.FromFile(dlg.FileName);

        this.pictureBox1.Image=_gifImage;

        cp=_gifImage.Palette;

        this.panel1.Invalidate();

      }

    }

 

    private void button2_Click(object sender, System.EventArgs e)

    {

      SaveFileDialog dlg=new SaveFileDialog();

      dlg.Filter="GIF files|*.gif";

      dlg.DefaultExt=".gif";

      dlg.AddExtension=true;

      if(dlg.ShowDialog()==DialogResult.OK)

      {

        _gifImage.Save(dlg.FileName,ImageFormat.Gif);

      }

    }

 

    private void button3_Click(object sender, System.EventArgs e)

    {

      Application.Exit();

    }

 

    bool showTrans;

 

    private void timer1_Tick(object sender, System.EventArgs e)

    {

      showTrans^=true;

      Graphics g=this.panel1.CreateGraphics();

      //I do this rather than invalidate the panel because

      //the panel draws its background ans so flickers horribly.

      PaintEventArgs pe=new PaintEventArgs(g,new Rectangle(0,0,this.panel1.Width,this.panel1.Height));

      this.panel1_Paint(this,pe);

      g.Dispose();

    }

  }

}

实现透明的PictureBox控件 在C#中,PictureBox控件默认情况下是无法实现真正的透明效果的。然而,我们可以通过一些技巧和代码来实现一个近似透明的效果。现在,我们可以在窗体中使用这个自定义的透明PictureBox控件了。通过运行上述代码,您将看到一个具有透明背景的PictureBox控件,并显示了指定的图片。如果不是透明的,就使用背景颜色填充整个控件的区域。首先,我们需要创建一个自定义控件,继承自PictureBox。,并在其中添加了一个透明的PictureBox控件。在上面的代码中,我们首先将控件的。 阅读详情

相关推荐

C# 中图片格式转换的全面指南

在现代信息技术飞速发展的背景下,图片格式转换已经成为日常工作中不可或缺的一部分。无论是为了优化网页加载时间、减少存储空间,还是为了满足特定的显示需求,掌握高效的图片格式转换技巧是每个IT专业人士的必备技能。C#作为微软开发的一种面向对象、类型安全的编程语言,广泛应用于企业级应用开发。利用C#进行图片格式转换,不仅可以提高开发效率,还可以利用其强大的.NET框架库,实现复杂的功能。

weixin_33239721的博客 1111

C#制作透明色GIF动画的类

前几天,关注了下GIF的文件结构 发现一个GIF文件大小错很多.发现主要是3个地方的问题.一是色彩表的问题.GIF有全局色彩表和图形色彩表.二是GIF图形的大小并不一定是一样的 桢1可能是100*100的 桢2可能是10*10 比如天空是黑色100*100 星星在是10*10 三是描述区,没什么作用就是描述 图形一样大小不一样的就这两个地方区别大. 用C#来实现下

Zgke 1万+

C#实现WDF/WAS游戏资源解析:从二进制数据到PNG图片的完整导出方案

在游戏开发和资源逆向工程中,解析自定义二进制格式是常见需求。索引色图像格式通过调色板映射实现高效存储,其原理是将像素颜色编码为调色板索引而非直接RGB值。这种技术能显著减少文件体积,在早期游戏资源包中广泛应用。通过C#的System.Drawing库和二进制读取技术,开发者可以深入理解文件结构解析、内存流操作和图像生成的工程实践。本文以经典游戏《大话西游》的WDF资源包和WAS图片格式为例,详细展示了如何通过十六进制分析确定文件结构,实现从资源包提取、调色板解析到像素重建的完整流程。该方案不仅解决了特定游戏

weixin_34355559的博客 335

C#中保存Gif文件设置透明无效果

在C#中使用Graphics.Clear(Color.Transparent)生成gif格式透明文件时,设置透明不起作用。使用Bitmap.MakeTransparent 方法同样也不能使gif文件透明。这两个问题也是微软的设计使然,和gif文件格式有关系。 如果要在c#中编程实现透明色,必须另写代码,下面是一位老外的代码 /// &lt;summary&gt; /// Make the i...

weixin_34185512的博客 276

C#文字转透明背景图片

C#文字转透明背景图片,传人文字信息生成文字透明背景的图片

初识机会网络仿真器ONE中ExternalMovement移动模型(导入外部移动数据)

最近半个月一直在研究ONE中关于ExternalMovement移动模型的源代码,在网上几乎没有找到相关的资料,很是苦恼,如果有共同研究方向的小伙伴欢迎联系我,共同讨论进步。 下面记录一下几点感悟: 1、使用外部数据的前提是在ONE的配置文件中增加及修改相关代码: Group.movementModel = ExternalMovement ExternalMovement.file = move...

qq_36974792的博客 665

怎么利用C#创建透明的GIF图片

Code usingSystem; usingSystem.IO; usingSystem.Drawing; usingSystem.Drawing.Imaging; usingSystem.Collections; usingSystem.ComponentModel; usingSystem.Windows.Forms; usingSystem.D...

weixin_30810583的博客 231

ROS通信机制深度解析:为什么话题订阅模型比服务调用更适合你的机器人项目?

本文深入解析ROS通信机制,重点探讨话题订阅模型相较于服务调用在机器人项目中的优势。通过性能对比和架构分析,揭示话题模型在异步通信、系统解耦和实时数据处理方面的卓越表现,特别适合传感器数据流和高频控制场景。文章还提供了实际案例和高级应用技巧,帮助开发者优化机器人系统设计。

weixin_29172963的博客 105

[johnsuna(阿山NET)的专栏]怎么利用C#创建透明的GIF图片?(可自定义调色板),收藏一下.

function StorePage(){d=document;t=d.selection?(d.selection.type!=None?d.selection.createRange().text:):(d.getSelection?d.getSelection():);void(keyit=window.open(http://www.365key.com/storeit.as

一路采撷 2025

TSC条码打印机C#例程(tsclib.dll调用) 【转】

//----program.cs using System;using System.Collections.Generic;using System.Windows.Forms; using System.Runtime.InteropServices;public class TSCLIB_DLL{[DllImport("TSCLIB.dll", EntryPoint = "abou...

weixin_33843947的博客 2448

PVE 9.0 保姆级安装及优化教程(换源、网络配置、远程唤醒等)【基础篇】

最近,Proxmox VE 推出了基于 Debian 13 的 9.0 版本。正巧我手头有一台闲置的老电脑,与其闲置,不如装上 PVE,让它化身 All in One,继续发挥它的余热。G4560 算是一颗 NAS 神 U,十几元的售价就能有双核四线程,比起什么 J1900 不知道强到哪里去了,尽管定位上是奔腾处理器,但性能甚至能和同代的酷睿 i3-7100 掰掰手腕,并且它还自带 HD 610 的核显,对于解码的支持也还不错。

zc_mk的博客 7550

C#中保存GIF文件后透明背景问题的一个解决方法

  以前在用C#做网站保存缩略图的程序中发现,当保存为GIF文件类型时,原来的透明背景变成了黑色,当时由于赶时间,就统一用白色代替了背景,并用Jpeg格式存储,并没有深究。  近来在网上查阅了许多资料,看到了两种解决方法:一种是在显示时设置透明背景色,GIF文件本身并不改变,另一种是不推荐使用的调用API的方法。将后一种I的VB源码用C#重写后,发现其中的调色板设置太少,转换效果不理想。 

砖头的专栏 3783

2026实战:YOLOv11融合Swin Transformer,小目标检测精度暴涨47%

本文针对工业零件微小缺陷检测难题,提出了一种CNN与Transformer的最优融合方案。作者发现直接替换YOLOv11骨干网络为Swin Transformer会导致速度骤降69%而精度仅提升2.1%。通过大量实验,总结出三项核心设计原则:1)CNN为主、Transformer为辅;2)高层插入、浅层保留;3)模块化融合。最终提出三种渐进式融合方案,其中骨干部分替换方案(方案二)实现了小目标检测精度提升47%,推理速度仅下降8%的优异表现。文章详细解析了Swin Transformer的核心原理,提供了完

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 520

C#中保存GIF文件后透明背景问题的最终解决方法

前文C#中保存GIF文件后透明背景问题的一个解决方法有个较为明显的缺陷,就是调色板的固定,导致颜色显示不理想,现根据网友传来的另一版本,解决如下:using System;using System.Drawing;using System.Drawing.Imaging;using System.Drawing.Drawing2D;using System.Data;usi

砖头的专栏 2248

Python航空航天设计神器!从入门到实操,小白也能搞定飞机优化

AeroSandbox的核心价值的是:​降低航空工程优化的门槛,用Python实现高效、简洁的工程设计​。无论是科研、学习还是实际项目,它都能帮你节省大量时间,不用再手动推导导数、编写复杂的优化逻辑。对于新手来说,建议先从案例1(Rosenbrock函数)入手,熟悉优化流程,再尝试案例2(翼型优化),逐步掌握核心用法;对于有航空相关需求的小伙伴,可以深入研究内置的物理模型,结合自己的项目进行定制化开发。最后,互动时间到!👉 你是用AeroSandbox做科研、练手还是实际项目?

源代码杀手的博客 142

Python 爬虫实战:雪球用户数据爬取与投资行为分析(含 API 签名算法解析)

雪球作为国内领先的投资者社区,拥有丰富的用户数据和投资信息。通过爬取雪球用户数据并进行分析,我们可以深入了解用户的持仓偏好、交易行为和投资策略,为企业和投资者提供有价值的市场洞察。

yansideyucsdn的博客 2254

C#更改gif图片大小后仍然保持动画效果

先声明,不是我原创的,我也是借鉴别人的方法。 public Form1() { InitializeComponent(); PictureBox picImg = new PictureBox(); int width = 100; int height = 6

ojlovecd的专栏 1万+

用Python爬取大连商品交易所期货实时行情:从入门到实战

python复制编辑# utils.py"豆粕": "M0","铁矿石": "I0","聚乙烯": "L0","玉米": "C0","聚丙烯": "PP0","棕榈油": "P0"本项目展示了:✅ 如何从新浪财经 API获取主力合约实时数据✅ 使用Python异步爬虫技术) 提升效率✅ 利用pandas和matplotlib进行结构化分析与可视化✅ 具备良好的扩展性,可对接金融、农业、能源等数据需求场景✅ 可作为期货量化策略数据源✅ 可嵌入自动化报告系统。

2201_76125261的博客 1254

ASP.NET直接写透明GIF图像到输出流源代码

写图片到HTTP-Response输出流是非常简单的,不过写一个透明的GIF图像到输出流就比较困难了。这个程序,在ASP.NET中使用C#语言先创建调色板,然后改变所有Alpha值到0,这时候才会透明GIF中的透明颜色。 System.Drawing.Image _gifImage; _gifImage = System.Drawing.Image.FromFile(Server.M...

weixin_30709809的博客 80

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

C#修改GIF大小同时保持GIF仍然可动和背景透明

/// &lt;summary&gt; /// 设置GIF大小 /// &lt;/summary&gt; /// &lt;param name="path"&gt;图片路径&lt;/param&gt; /// &lt;param name="width"&gt;宽&lt;/param&

weixin_34206899的博客 344

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

Unity动态图像解码全解析:从GIF原理到UniGif实战优化

动态图像解码是计算机图形学与多媒体处理中的基础技术,其核心原理在于解析图像容器格式、解压编码数据并还原为可渲染的帧序列。在游戏开发领域,Unity引擎因其跨平台特性被广泛应用,但其对GIF等动态格式缺乏原生支持,这催生了运行时解码的技术需求。通过实现高效的解码器,开发者能够在游戏UI、动态贴图等场景中灵活使用网络或本地的GIF资源,增强内容表现力。本文以热门的开源方案UniGif为例,深入剖析其纯C#实现的解码流程,涵盖LZW解压缩、调色板应用等关键环节,并针对性能瓶颈提供异步解码、内存管理等工程优化策略,

weixin_33736832的博客 438

[开源]基于WPF实现的Gif图片分割器,提取GIf图片中的每一帧

原文:[开源]基于WPF实现的Gif图片分割器,提取GIf图片中的每一帧  不知不觉又半个月没有更新博客了,今天终于抽出点时间,来分享一下前段时间的成果。   在网上,我们经常看到各种各样的图片,尤其是GIF图片的动态效果,让整个网站更加富有表现力!有时候,我们看到一些比较好看的GIF图片或者一些奇特的Gif图片,我们想要停留在某一帧看的清楚一点或者了解这个Gif动画到底是怎么实现的,怀着这种好...

weixin_33994429的博客 183
上一篇: 小技巧集锦(1)[陆续贴上,网友也可以加哟]
下一篇: asp.net在线压缩和解压缩的实现
大可山人
大可山人 领域专家: 后端开发技术领域 领域专家: 后端开发技术领域
博客等级 码龄24年 1674粉丝 433原创
评论 1
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值