• 大小: 643KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-06-01
  • 语言: 其他
  • 标签: LSB  图片处理  

资源简介

亲测可以用的LSB图片水印嵌入代码 很不错的东西

资源截图

代码片段和文件信息


package process.algorithms;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.io.*;
import process.rw.RAW;
import process.common.Common;

public class Ch15ImageWatermark extends Jframe implements ActionListener
{
    Image iImage oImage;
    BufferedImage bImage;
    
    int   iw ih;
    int[] pixels
          cphpix;             //加密图像数组 
     
    boolean loadflag = false
            runflag  = false; //图像处理执行标志 
    
    String imn               //图像文件名
           imh               //加密图像标识“c_“
       wtr
       title;             //图像标题               
              
    ImageWatermark watermark;
    RAW reader;
    Common common;
    
    public Ch15ImageWatermark()
    {    
        settitle(“1007052222“);
        this.setBackground(Color.lightGray);        
              
        //菜单界面
        setMenu();
                
        watermark = new ImageWatermark();
        reader = new RAW();
        common = new Common();
        
        //关闭窗口
        closeWin();
        
        setSize(530 330);
        setVisible(true);
    }

    public void actionPerformed(ActionEvent evt)
    {
     Graphics graph = getGraphics();
     MediaTracker tracker = new MediaTracker(this); 
            
        if (evt.getSource() == openItem) 
        {
         JFileChooser chooser = new JFileChooser();
            common.chooseFile(chooser “./images/ch15“ 0);
            int r = chooser.showOpenDialog(null);     
            
            if(r == JFileChooser.APPROVE_OPTION) 
            {
             if(runflag)
                {
                 loadflag = false;   
                    runflag  = false; 
                }             
                
                if(!loadflag)
    {
     String name = chooser.getSelectedFile().getAbsolutePath(); 
                
                //取文件名 
                String filename = chooser.getSelectedFile().getName(); 
                
                int len = filename.length();
                
                //取扩展名
                String exname = filename.substring(len-3 len);
                
                //取文件名imn
                imn = filename.substring(0 len-4);
                 
                //取加密标识imh               
                imh = filename.substring(0 2);
                
                 if(exname.equalsIgnoreCase(“raw“))
                {                 
                    pixels = reader.readRAW1D(name iw ih);
                    ImageProducer ip = new MemoryImageSource(iw ih 
                                                             pixels 0 iw);
                iImage = createImage(ip);                      
                }
                else
                    {
                //装载图像
    iImage = common.openImage(name tracker);    
    //取载入图像的宽和高
   

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-12-23 16:27  ZLJImageProcess\
     文件         301  2013-12-23 16:12  ZLJImageProcess\.classpath
     文件         391  2013-12-08 16:48  ZLJImageProcess\.project
     目录           0  2013-12-23 16:27  ZLJImageProcess\.settings\
     文件         629  2013-12-08 16:48  ZLJImageProcess\.settings\org.eclipse.jdt.core.prefs
     目录           0  2013-12-23 16:27  ZLJImageProcess\bin\
     目录           0  2013-12-23 16:27  ZLJImageProcess\bin\process\
     目录           0  2013-12-23 16:27  ZLJImageProcess\bin\process\algorithms\
     文件         780  2013-12-23 16:26  ZLJImageProcess\bin\process\algorithms\Ch15ImageWatermark$1.class
     文件        6511  2013-12-23 16:26  ZLJImageProcess\bin\process\algorithms\Ch15ImageWatermark.class
     文件        1041  2013-12-23 16:18  ZLJImageProcess\bin\process\algorithms\ImageWatermark.class
     目录           0  2013-12-23 16:27  ZLJImageProcess\bin\process\common\
     文件        1739  2013-12-23 16:22  ZLJImageProcess\bin\process\common\Common$1.class
     文件       16149  2013-12-23 16:22  ZLJImageProcess\bin\process\common\Common.class
     目录           0  2013-12-23 16:27  ZLJImageProcess\bin\process\rw\
     文件        2518  2013-12-23 16:19  ZLJImageProcess\bin\process\rw\RAW.class
     目录           0  2013-12-23 16:27  ZLJImageProcess\images\
     目录           0  2013-12-23 16:27  ZLJImageProcess\images\ch15\
     文件       19712  2013-12-22 17:34  ZLJImageProcess\images\ch15\Baboo.jpg
     文件        8254  2013-12-23 16:25  ZLJImageProcess\images\ch15\Bigwater.bmp
     文件        5599  2013-12-22 17:34  ZLJImageProcess\images\ch15\Bigwater.jpg
     文件        6353  2013-12-22 17:34  ZLJImageProcess\images\ch15\bird.jpg
     文件       13216  2013-12-22 17:34  ZLJImageProcess\images\ch15\cameraman.JPG
     目录           0  2013-12-23 16:27  ZLJImageProcess\images\ch15\jpg\
     文件       59427  2013-12-22 17:34  ZLJImageProcess\images\ch15\jpg\j_Baboo.jpg
     文件       21923  2013-12-22 17:34  ZLJImageProcess\images\ch15\jpg\j_Baboo2.jpg
     文件        7718  2013-12-22 17:34  ZLJImageProcess\images\ch15\jpg\j_bird.jpg
     文件        7563  2013-12-22 17:34  ZLJImageProcess\images\ch15\jpg\j_bird2.jpg
     文件       52995  2013-12-22 17:34  ZLJImageProcess\images\ch15\jpg\j_cameraman.jpg
     文件       11502  2013-12-22 17:34  ZLJImageProcess\images\ch15\jpg\j_cameraman2.jpg
     文件       13582  2013-12-22 17:34  ZLJImageProcess\images\ch15\jpg\j_int.jpg
............此处省略23个文件信息

评论

共有 条评论