• 大小: 51KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-08
  • 语言: 其他
  • 标签: 信息隐藏  

资源简介

基于离散余弦变换的数字水印潜入算法,可以直接运行的源代码

资源截图

代码片段和文件信息

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.Drawing.Imaging;

namespace InformationHide
{
    public partial class Form1 : Form
    {
        Image originalimage;
        Image watermark;
        private System.Windows.Forms.PictureBox pictureBox1;
        private System.Windows.Forms.Button btnAddCopyright;
        /// 
        /// Required designer variable.
        /// 

       
        public Form1()
        {
            InitializeComponent();
        }

        private void btnOpenFile_Click(object sender EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            openFileDialog1.InitialDirectory = @“C:\Users\zd\Desktop“;
            openFileDialog1.Filter = “All files (*.*)|*.*“;
            openFileDialog1.FilterIndex = 2;
            openFileDialog1.RestoreDirectory = true;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                originalimage = System.Drawing.Image.FromFile(openFileDialog1.FileName.ToString());
                Image ithumbnail = originalimage.GetThumbnailImage(pictureBox1.Width pictureBox1.Height null new IntPtr());
                pictureBox1.Image = ithumbnail;
                btnAddCopyright.Enabled = true;
            }
        }

        private void btnAddCopyright_Click(object sender System.EventArgs e)
        {
            int imagewidth;
            int imageheight;
            int fontsize = 20;
            int x y;
            int a re gr bl x1 y1 z1;
            int size;
            Bitmap pattern;
            SizeF sizeofstring;
            bool foundfont;
            imagewidth = originalimage.Width;
            imageheight = originalimage.Height;
            size = imagewidth * imageheight;
            pattern = new Bitmap(imagewidth imageheight);//创建一个二进制位图
            Bitmap temp = new Bitmap(originalimage);//原位图图像
            Graphics g = Graphics.FromImage(pattern);

            //Graphics g = Graphics.FromImage(watermark);
            
            Graphics tempg = Graphics.FromImage(originalimage);
                        //find a font size that will fit in the bitmap
            foundfont = false;
            g.Clear(Color.White);
            while (foundfont == false)
            {
                Font fc = new Font(“Georgia“ fontsize System.Drawing.Fontstyle.Italic);
                sizeofstring = new SizeF(imagewidth imageheight);
                sizeofstring = g.MeasureString(textBox1.Text fc);
                if (sizeofstring.Width < pattern.Width)
                {
                    if (sizeofstring.Height < pattern.Height)
                    {
                        foundfont = true;
                        g.DrawString(textBox1.Text fc new S

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2011-06-30 08:54  InformationHide\
     目录           0  2011-06-30 08:54  InformationHide\InformationHide\
     文件         887  2011-06-28 11:25  InformationHide\InformationHide.sln
     文件       20992  2011-07-02 14:50  InformationHide\InformationHide.suo
     目录           0  2011-06-30 08:54  InformationHide\InformationHide\bin\
     目录           0  2011-06-30 08:54  InformationHide\InformationHide\bin\Debug\
     文件       11776  2011-07-02 14:47  InformationHide\InformationHide\bin\Debug\InformationHide.exe
     文件       26112  2011-07-02 14:47  InformationHide\InformationHide\bin\Debug\InformationHide.pdb
     文件       11600  2011-07-02 14:50  InformationHide\InformationHide\bin\Debug\InformationHide.vshost.exe
     文件         490  2010-03-17 22:39  InformationHide\InformationHide\bin\Debug\InformationHide.vshost.exe.manifest
     文件        5644  2011-07-02 14:47  InformationHide\InformationHide\Form1.cs
     文件        5774  2011-07-02 14:38  InformationHide\InformationHide\Form1.Designer.cs
     文件        5817  2011-07-02 14:38  InformationHide\InformationHide\Form1.resx
     文件        3689  2011-06-28 11:35  InformationHide\InformationHide\InformationHide.csproj
     目录           0  2011-06-30 08:54  InformationHide\InformationHide\obj\
     目录           0  2011-06-30 08:54  InformationHide\InformationHide\obj\x86\
     目录           0  2011-07-02 14:47  InformationHide\InformationHide\obj\x86\Debug\
     文件        4440  2011-06-28 21:00  InformationHide\InformationHide\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
     文件        6253  2011-07-02 14:47  InformationHide\InformationHide\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     文件         514  2011-07-02 14:38  InformationHide\InformationHide\obj\x86\Debug\GenerateResource.read.1.tlog
     文件        1458  2011-07-02 14:38  InformationHide\InformationHide\obj\x86\Debug\GenerateResource.write.1.tlog
     文件        1535  2011-07-02 14:50  InformationHide\InformationHide\obj\x86\Debug\InformationHide.csproj.FileListAbsolute.txt
     文件       11776  2011-07-02 14:47  InformationHide\InformationHide\obj\x86\Debug\InformationHide.exe
     文件         180  2011-07-02 14:38  InformationHide\InformationHide\obj\x86\Debug\InformationHide.Form1.resources
     文件       26112  2011-07-02 14:47  InformationHide\InformationHide\obj\x86\Debug\InformationHide.pdb
     文件         180  2011-06-30 08:57  InformationHide\InformationHide\obj\x86\Debug\InformationHide.Properties.Resources.resources
     文件        7897  2011-06-28 23:04  InformationHide\InformationHide\obj\x86\Debug\ResolveAssemblyReference.cache
     目录           0  2011-06-28 11:25  InformationHide\InformationHide\obj\x86\Debug\TempPE\
     文件         496  2011-06-28 11:25  InformationHide\InformationHide\Program.cs
     目录           0  2011-06-30 08:54  InformationHide\InformationHide\Properties\
     文件        1362  2011-06-28 11:25  InformationHide\InformationHide\Properties\AssemblyInfo.cs
............此处省略4个文件信息

评论

共有 条评论