生成艺术字体图片水印代码_PHP教程
//adv0.jpg就是背景图片,注意函数与图片格式对应
$im = imagecreatefromjpeg('/www/law/images/demo/adv0.jpg');
$font_color = imagecolorallocate ($im, 0, 250, 10); //这是文字颜色,绿色
$text = "张三的博客"; //文字内容
$font_file = "/www/font/hyi_xkj.ttf"; //字体的linux绝对路径
//26:字体, 0 是角度, 10,36是坐标, $font_color是文字色, font是字体, 文本是填入的文字
imagettftext($im, 26,0, 10, 36, $font_color ,$font_file, $text); 往图片插入文字
// output image
header ('content-type: image/png'); //即便是从jpg拷贝的图片,也能以png输出,
imagepng ($im);
// clean up
imagedestroy($im);
生成水印方法二
public final class imageutils {
public imageutils() {}
public final static string getpressimgpath(){
return applicationcontext.getrealpath("/template/data/util/shuiyin.gif");
}/**
* 把图片印刷到图片上
* @param pressimg -- 水印文件
* @param targetimg -- 目标文件
* @param x
* @param y
*/
public final static void pressimage(string pressimg, string targetimg, int x, int y) {
try {
file _file = new file(targetimg);
image src = imageio.read(_file);
int wideth = src.getwidth(null);
int height = src.getheight(null);
bufferedimage image = new bufferedimage(wideth, height,
bufferedimage.type_int_rgb);
graphics g = image.creategraphics();
g.drawimage(src, 0, 0, wideth, height, null);// 水印文件
file _filebiao = new file(pressimg);
image src_biao = imageio.read(_filebiao);
int wideth_biao = src_biao.getwidth(null);
int height_biao = src_biao.getheight(null);
g.drawimage(src_biao, wideth - wideth_biao - x, height - height_biao -y, wideth_biao,
height_biao, null);
// /
g.dispose();
fileoutputstream out = new fileoutputstream(targetimg);
jpegimageencoder encoder = jpegcodec.createjpegencoder(out);
encoder.encode(image);
out.close();
} catch (exception e) {
e.printstacktrace();
}
}/**
* 打印文字水印图片
* @param presstext --文字
* @param targetimg -- 目标图片
* @param fontname -- 字体名
* @param fontstyle -- 字体样式
* @param color -- 字体颜色
* @param fontsize -- 字体大小
* @param x -- 偏移量
* @param y
*/public static void presstext(string presstext, string targetimg, string fontname,int fontstyle, int color, int fontsize, int x, int y) {
try {
file _file = new file(targetimg);
image src = imageio.read(_file);
int wideth = src.getwidth(null);
int height = src.getheight(null);
bufferedimage image = new bufferedimage(wideth, height,
bufferedimage.type_int_rgb);
graphics g = image.creategraphics();
g.drawimage(src, 0, 0, wideth, height, null);
// string s=www.bKjia.c0m;
g.setcolor(color.red);
g.setfont(new font(fontname, fontstyle, fontsize));
g.drawstring(presstext, wideth - fontsize - x, height - fontsize/2 - y);
g.dispose();
fileoutputstream out = new fileoutputstream(targetimg);
jpegimageencoder encoder = jpegcodec.createjpegencoder(out);
encoder.encode(image);
out.close();
} catch (exception e) {
system.out.println(e);
}
}public static void main(string[] args) {
pressimage("c:/shuiyin/shuiyin.gif", "c:/shuiyin/dsc02342.jpg", 20 ,20);
}
}

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

win1124H2如何消除右下角的評估副本文字?我們在使用系統的時候有時候桌面會在右下角的螢幕顯示一個透明的浮水印,那麼這個透明的水印要怎麼去掉?使用者可以直接的利用第三方軟體來進行操作就可以了。以下就讓本站來為使用者來仔細的介紹一下消除win1124H2評估副本浮水印的方法吧。消除win1124H2評估副本浮水印的方法下載UniversalWatermarkDisabler工具,運行後會顯示出目前系統的版本以及水印狀態,「Status」中顯示「Readyforinstallation」即已可以移除

Go語言提供了兩種動態函數創建技術:closures和反射。 closures允許存取閉包作用域內的變量,而反射可使用FuncOf函數建立新函數。這些技術在自訂HTTP路由器、實現高度可自訂的系統和建置可插拔的元件方面非常有用。

在C++函數命名中,考慮參數順序至關重要,可提高可讀性、減少錯誤並促進重構。常見的參數順序約定包括:動作-物件、物件-動作、語意意義和遵循標準函式庫。最佳順序取決於函數目的、參數類型、潛在混淆和語言慣例。

1. SUM函數,用於對一列或一組單元格中的數字進行求和,例如:=SUM(A1:J10)。 2、AVERAGE函數,用於計算一列或一組儲存格中的數字的平均值,例如:=AVERAGE(A1:A10)。 3.COUNT函數,用於計算一列或一組單元格中的數字或文字的數量,例如:=COUNT(A1:A10)4、IF函數,用於根據指定的條件進行邏輯判斷,並返回相應的結果。

自2023年3月14日開始,ChatGLM-6B以來,GLM系列模型受到了廣泛的關注與認可。特別是在ChatGLM3-6B開源之後,開發者對智譜AI推出的第四代模型充滿了期待。而這項期待,隨著GLM-4-9B的發布,終於得到了充分的滿足。 GLM-4-9B的誕生為了賦予小模型(10B及以下)更加強大的能力,GLM技術團隊經過近半年的探索,推出了這款全新的第四代GLM系列開源模型:GLM-4-9B。這一模型在確保精度的同時,大幅度壓縮了模型大小,具有更快的推理速度和更高的效率。 GLM技術團隊的探索沒

自訂PHP函數與預定義函數的差異在於:作用域:自訂函數僅限於其定義範圍,而預定義函數可在整個腳本中存取。定義方式:自訂函數使用function關鍵字定義,而預先定義函數則由PHP核心定義。參數傳遞:自訂函數接收參數,而預先定義函數可能不需要參數。擴充性:自訂函數可以根據需要創建,而預定義函數是內建的且無法修改。

C++中的異常處理可透過自訂異常類別增強,提供特定錯誤訊息、上下文資訊以及根據錯誤類型執行自訂操作。定義繼承自std::exception的異常類,提供特定的錯誤訊息。使用throw關鍵字拋出自訂異常。在try-catch區塊中使用dynamic_cast將捕獲到的異常轉換為自訂異常類型。在實戰案例中,open_file函數會拋出FileNotFoundException異常,捕捉並處理該異常可提供更具體的錯誤訊息。
