真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

去視頻水印java代碼,網(wǎng)頁(yè)視頻去水印代碼

咪咕視頻去水印代碼

打開(kāi)目標(biāo)影視網(wǎng)站,進(jìn)入要看的視頻。

在遜克等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強(qiáng)發(fā)展的系統(tǒng)性、市場(chǎng)前瞻性、產(chǎn)品創(chuàng)新能力,以專(zhuān)注、極致的服務(wù)理念,為客戶提供成都網(wǎng)站設(shè)計(jì)、做網(wǎng)站 網(wǎng)站設(shè)計(jì)制作按需網(wǎng)站開(kāi)發(fā),公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),品牌網(wǎng)站建設(shè),全網(wǎng)營(yíng)銷(xiāo)推廣,成都外貿(mào)網(wǎng)站建設(shè),遜克網(wǎng)站建設(shè)費(fèi)用合理。

1、按下F12或鼠標(biāo)右鍵檢查進(jìn)入開(kāi)發(fā)者人員工具。

2、點(diǎn)擊Console控制欄。

3、在底部輸入?yún)^(qū)粘貼下列代碼片段,按回車(chē)即可執(zhí)行。

用java給視頻水印LOGO

用過(guò)濾器,等我上線給你,不要結(jié)問(wèn)題哦

package com.jc.ts.services;

import java.awt.Color;

import java.awt.Graphics;

import java.awt.Image;

import java.awt.image.BufferedImage;

import java.io.FileInputStream;

import java.io.FileNotFoundException;

import java.io.IOException;

import javax.imageio.ImageIO;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import com.sun.image.codec.jpeg.ImageFormatException;

import com.sun.image.codec.jpeg.JPEGCodec;

import com.sun.image.codec.jpeg.JPEGImageEncoder;

/**

*添加圖片水印的服務(wù)類(lèi)

* */

public class WaterMark {

/**

* @param sizeContext添加水印文字

* @param request 請(qǐng)求流對(duì)象

* @param request 響應(yīng)流對(duì)象

* */

@SuppressWarnings("deprecation")

public static void createMarkSize(String sizeContext,HttpServletRequest request,HttpServletResponse response) {

try {

String path=request.getRealPath(request.getServletPath());

FileInputStream in=new FileInputStream(path);

Image src=ImageIO.read(in);

int w=src.getWidth(null);

int h=src.getHeight(null);

BufferedImage img=new BufferedImage(w,h,BufferedImage.TYPE_INT_RGB);//構(gòu)建畫(huà)板

Graphics g=img.getGraphics();//得到畫(huà)筆

g.drawImage(src,0,0,w,h,null);//把源圖片寫(xiě)入畫(huà)板

g.setColor(Color.red);

g.drawString(sizeContext,10,5); // 添加文字

g.dispose();//生成圖片

JPEGImageEncoder e=JPEGCodec.createJPEGEncoder(response.getOutputStream());

e.encode(img);

response.getOutputStream().close();

} catch (FileNotFoundException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (ImageFormatException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (IOException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

/**

* @param localPath 添加水印LOGO路徑

* @param request 請(qǐng)求流對(duì)象

* @param request 響應(yīng)流對(duì)象

**/

@SuppressWarnings("deprecation")

public static void createMarkLogo(String localPath,HttpServletRequest request,HttpServletResponse response) {

try {

FileInputStream file=new FileInputStream(localPath);

Image fimg=ImageIO.read(file);

int fw=fimg.getWidth(null);

int fh=fimg.getHeight(null);

String path=request.getRealPath(request.getServletPath());

FileInputStream in=new FileInputStream(path);

Image src=ImageIO.read(in);

int w=src.getWidth(null);

int h=src.getHeight(null);

BufferedImage img=new BufferedImage(w,h,BufferedImage.TYPE_INT_RGB);//構(gòu)建畫(huà)板

Graphics g=img.getGraphics();//得到畫(huà)筆

g.drawImage(src,0,0,w,h,null);//把原圖片寫(xiě)入畫(huà)板

g.drawImage(fimg,w-20,h-15,fw,fh,null);//把水印圖片寫(xiě)入畫(huà)板

g.dispose();//生成圖片

JPEGImageEncoder e=JPEGCodec.createJPEGEncoder(response.getOutputStream());

e.encode(img);

response.getOutputStream().close();

} catch (FileNotFoundException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (ImageFormatException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (IOException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

}

/**

* @param localPath 添加水印圖片路徑

* @param request 請(qǐng)求流對(duì)象

* @param request 響應(yīng)流對(duì)象

* @param width 水印圖片的寬度

* @param height 水印圖片的長(zhǎng)度

**/

@SuppressWarnings("deprecation")

public static void createMarkLogo(String localPath,HttpServletRequest request,HttpServletResponse response,int width,int height) {

try {

FileInputStream file=new FileInputStream(localPath);

Image fimg=ImageIO.read(file);

int fw=fimg.getWidth(null);

int fh=fimg.getHeight(null);

String path=request.getRealPath(request.getServletPath());

FileInputStream in=new FileInputStream(path);

Image src=ImageIO.read(in);

int w=src.getWidth(null);//w為你過(guò)濾圖片的寬度

int h=src.getHeight(null);//h為你過(guò)濾圖片的長(zhǎng)度

BufferedImage img=new BufferedImage(w+width,h+height,BufferedImage.TYPE_INT_RGB);//構(gòu)建畫(huà)板(畫(huà)板的寬度為兩個(gè)圖片之和)

Graphics g=img.getGraphics();//得到畫(huà)筆

g.drawImage(src,0,0,w,h,null);//把原圖片寫(xiě)入畫(huà)板

g.drawImage(fimg,width,height,fw,fh,null);//把水印圖片寫(xiě)入畫(huà)板

g.dispose();//生成圖片

JPEGImageEncoder e=JPEGCodec.createJPEGEncoder(response.getOutputStream());

e.encode(img);

response.getOutputStream().close();

} catch (FileNotFoundException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (ImageFormatException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (IOException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

}

注意第三個(gè)方法的注釋地方g.drawImage(fimg,width,height,fw,fh,null);根據(jù)參數(shù)你在調(diào)調(diào)(放原圖下面的)

過(guò)濾器調(diào)用

package com.jc.ts.filter;

import java.io.IOException;

import javax.servlet.Filter;

import javax.servlet.FilterChain;

import javax.servlet.FilterConfig;

import javax.servlet.ServletException;

import javax.servlet.ServletRequest;

import javax.servlet.ServletResponse;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import com.jc.ts.services.WaterMark;

public class WaterFilter implements Filter {

public void destroy() {

// TODO Auto-generated method stub

}

public void doFilter(ServletRequest arg0, ServletResponse arg1,

FilterChain arg2) throws IOException, ServletException {

HttpServletRequest request=(HttpServletRequest)arg0;

HttpServletResponse response=(HttpServletResponse)arg1;

//WaterMark.createMarkSize("南京ts", request, response);

//WaterMark.createMarkLogo("D:\\workspace\\mybook\\WebRoot\\images\\logo\\book.jpg", request, response);

WaterMark.createMarkLogo("D:\\workspace\\mybook\\WebRoot\\images\\logo\\book.jpg", request, response,20,30);

//注意路徑為絕對(duì)路徑且三個(gè)效果不能同時(shí)執(zhí)行

}

public void init(FilterConfig arg0) throws ServletException {

// TODO Auto-generated method stub

}

}

web.xml配置(寫(xiě)在servlet上面)

filter

descriptionThis is the description of my J2EE component/description

display-nameThis is the display name of my J2EE component/display-name

filter-nameWaterFilter/filter-name

filter-classcom.jc.ts.filter.WaterFilter/filter-class

/filter

希望你能滿意。。。。。。

如何用java去除圖片水???

//運(yùn)行以下程序即可

public?class?ImageInit?{

BufferedImage?image;

private?int?iw,?ih;

private?int[]?pixels;

public?ImageInit(BufferedImage?image)?{

this.image?=?image;

iw?=?image.getWidth();

ih?=?image.getHeight();

pixels?=?new?int[iw?*?ih];

}

public?BufferedImage?changeGrey()?{

PixelGrabber?pg?=?new?PixelGrabber(image.getSource(),?0,?0,?iw,?ih,

pixels,?0,?iw);

try?{

pg.grabPixels();

}?catch?(InterruptedException?e)?{

e.printStackTrace();

}

//?設(shè)定二值化的域值,默認(rèn)值為100

int?grey?=?100;

//?對(duì)圖像進(jìn)行二值化處理,Alpha值保持不變

ColorModel?cm?=?ColorModel.getRGBdefault();

for?(int?i?=?0;?i??iw?*?ih;?i++)?{

int?red,?green,?blue;

int?alpha?=?cm.getAlpha(pixels[i]);

if?(cm.getRed(pixels[i])??grey)?{

red?=?255;

}?else?{

red?=?0;

}

if?(cm.getGreen(pixels[i])??grey)?{

green?=?255;

}?else?{

green?=?0;

}

if?(cm.getBlue(pixels[i])??grey)?{

blue?=?255;

}?else?{

blue?=?0;

}

pixels[i]?=?alpha??24?|?red??16?|?green??8?|?blue;?//?通過(guò)移位重新構(gòu)成某一點(diǎn)像素的RGB值

}

//?將數(shù)組中的象素產(chǎn)生一個(gè)圖像

Image?tempImg?=?Toolkit.getDefaultToolkit().createImage(

new?MemoryImageSource(iw,?ih,?pixels,?0,?iw));

image?=?new?BufferedImage(tempImg.getWidth(null),

tempImg.getHeight(null),?BufferedImage.TYPE_INT_BGR);

image.createGraphics().drawImage(tempImg,?0,?0,?null);

return?image;

}

public?BufferedImage?getMedian()?{

PixelGrabber?pg?=?new?PixelGrabber(image.getSource(),?0,?0,?iw,?ih,

pixels,?0,?iw);

try?{

pg.grabPixels();

}?catch?(InterruptedException?e)?{

e.printStackTrace();

}

//?對(duì)圖像進(jìn)行中值濾波,Alpha值保持不變

ColorModel?cm?=?ColorModel.getRGBdefault();

for?(int?i?=?1;?i??ih?-?1;?i++)?{

for?(int?j?=?1;?j??iw?-?1;?j++)?{

int?red,?green,?blue;

int?alpha?=?cm.getAlpha(pixels[i?*?iw?+?j]);

//?int?red2?=?cm.getRed(pixels[(i?-?1)?*?iw?+?j]);

int?red4?=?cm.getRed(pixels[i?*?iw?+?j?-?1]);

int?red5?=?cm.getRed(pixels[i?*?iw?+?j]);

int?red6?=?cm.getRed(pixels[i?*?iw?+?j?+?1]);

//?int?red8?=?cm.getRed(pixels[(i?+?1)?*?iw?+?j]);

//?水平方向進(jìn)行中值濾波

if?(red4?=?red5)?{

if?(red5?=?red6)?{

red?=?red5;

}?else?{

if?(red4?=?red6)?{

red?=?red6;

}?else?{

red?=?red4;

}

}

}?else?{

if?(red4??red6)?{

red?=?red4;

}?else?{

if?(red5??red6)?{

red?=?red6;

}?else?{

red?=?red5;

}

}

}

int?green4?=?cm.getGreen(pixels[i?*?iw?+?j?-?1]);

int?green5?=?cm.getGreen(pixels[i?*?iw?+?j]);

int?green6?=?cm.getGreen(pixels[i?*?iw?+?j?+?1]);

//?水平方向進(jìn)行中值濾波

if?(green4?=?green5)?{

if?(green5?=?green6)?{

green?=?green5;

}?else?{

if?(green4?=?green6)?{

green?=?green6;

}?else?{

green?=?green4;

}

}

}?else?{

if?(green4??green6)?{

green?=?green4;

}?else?{

if?(green5??green6)?{

green?=?green6;

}?else?{

green?=?green5;

}

}

}

//?int?blue2?=?cm.getBlue(pixels[(i?-?1)?*?iw?+?j]);

int?blue4?=?cm.getBlue(pixels[i?*?iw?+?j?-?1]);

int?blue5?=?cm.getBlue(pixels[i?*?iw?+?j]);

int?blue6?=?cm.getBlue(pixels[i?*?iw?+?j?+?1]);

//?int?blue8?=?cm.getBlue(pixels[(i?+?1)?*?iw?+?j]);

//?水平方向進(jìn)行中值濾波

if?(blue4?=?blue5)?{

if?(blue5?=?blue6)?{

blue?=?blue5;

}?else?{

if?(blue4?=?blue6)?{

blue?=?blue6;

}?else?{

blue?=?blue4;

}

}

}?else?{

if?(blue4??blue6)?{

blue?=?blue4;

}?else?{

if?(blue5??blue6)?{

blue?=?blue6;

}?else?{

blue?=?blue5;

}

}

}

pixels[i?*?iw?+?j]?=?alpha??24?|?red??16?|?green??8

|?blue;

}

}

//?將數(shù)組中的象素產(chǎn)生一個(gè)圖像

Image?tempImg?=?Toolkit.getDefaultToolkit().createImage(

new?MemoryImageSource(iw,?ih,?pixels,?0,?iw));

image?=?new?BufferedImage(tempImg.getWidth(null),

tempImg.getHeight(null),?BufferedImage.TYPE_INT_BGR);

image.createGraphics().drawImage(tempImg,?0,?0,?null);

return?image;

}

public?BufferedImage?getGrey()?{

ColorConvertOp?ccp?=?new?ColorConvertOp(

ColorSpace.getInstance(ColorSpace.CS_GRAY),?null);

return?image?=?ccp.filter(image,?null);

}

//?Brighten?using?a?linear?formula?that?increases?all?color?values

public?BufferedImage?getBrighten()?{

RescaleOp?rop?=?new?RescaleOp(1.25f,?0,?null);

return?image?=?rop.filter(image,?null);

}

//?Blur?by?"convolving"?the?image?with?a?matrix

public?BufferedImage?getBlur()?{

float[]?data?=?{?.1111f,?.1111f,?.1111f,?.1111f,?.1111f,?.1111f,

.1111f,?.1111f,?.1111f,?};

ConvolveOp?cop?=?new?ConvolveOp(new?Kernel(3,?3,?data));

return?image?=?cop.filter(image,?null);

}

//?Sharpen?by?using?a?different?matrix

public?BufferedImage?getSharpen()?{

float[]?data?=?{?0.0f,?-0.75f,?0.0f,?-0.75f,?4.0f,?-0.75f,?0.0f,

-0.75f,?0.0f?};

ConvolveOp?cop?=?new?ConvolveOp(new?Kernel(3,?3,?data));

return?image?=?cop.filter(image,?null);

}

//?11)?Rotate?the?image?180?degrees?about?its?center?point

public?BufferedImage?getRotate()?{

AffineTransformOp?atop?=?new?AffineTransformOp(

AffineTransform.getRotateInstance(Math.PI,

image.getWidth()?/?2,?image.getHeight()?/?2),

AffineTransformOp.TYPE_NEAREST_NEIGHBOR);

return?image?=?atop.filter(image,?null);

}

public?BufferedImage?getProcessedImg()?{

return?image;

}

public?static?void?main(String[]?args)?throws?IOException?{

String?filePath="F:/k7qp5.png";

FileInputStream?fin?=?new?FileInputStream(filePath);

BufferedImage?bi?=?ImageIO.read(fin);

ImageInit?flt?=?new?ImageInit(bi);

flt.changeGrey();

flt.getGrey();

flt.getBrighten();

bi?=?flt.getProcessedImg();

String?pname?=?filePath.substring(0,?filePath.lastIndexOf("."));

File?file?=?new?File(pname?+?".jpg");

ImageIO.write(bi,?"jpg",?file);

}

}


當(dāng)前名稱:去視頻水印java代碼,網(wǎng)頁(yè)視頻去水印代碼
文章轉(zhuǎn)載:http://weahome.cn/article/hdsdgc.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部