導航:首頁 > 文字圖片 > 豎文字生成圖片

豎文字生成圖片

發布時間:2022-12-17 09:13:04

❶ java在生成圖片的時候,讓文字豎排展示,如何實現

packagehonest.imageio;

importjava.awt.Color;
importjava.awt.Font;
importjava.awt.Graphics;
importjava.awt.image.BufferedImage;
importjava.io.File;
importjava.io.IOException;

importjavax.imageio.ImageIO;

/**
*圖片操作類
*
*@author
*
*/
publicclassImageUtil{

privateBufferedImageimage;
privateintwidth;//圖片寬度
privateintheight;//圖片高度

publicImageUtil(intwidth,intheight){

this.width=width;
this.height=height;
image=newBufferedImage(width,height,BufferedImage.TYPE_INT_ARGB);
}

/**
*創建一個含有指定顏色字元串的圖片
*
*@parammessage
*字元串
*@paramfontSize
*字體大小
*@paramcolor
*字體顏色
*@return圖片
*/
publicBufferedImagedrawString(Stringmessage,intfontSize,Colorcolor){
Graphicsg=image.getGraphics();
g.setColor(color);
Fontf=newFont("宋體",Font.BOLD,fontSize);
g.setFont(f);
intlen=message.length();
g.drawString(message,(width-fontSize*len)/2,
(height+(int)(fontSize/1.5))/2);
g.dispose();
returnimage;
}

/**
*縮放圖片
*
*@paramscaleW
*水平縮放比例
*@paramscaleY
*垂直縮放比例
*@return
*/
publicBufferedImagescale(doublescaleW,doublescaleH){
width=(int)(width*scaleW);
height=(int)(height*scaleH);

BufferedImagenewImage=newBufferedImage(width,height,
image.getType());
Graphicsg=newImage.getGraphics();
g.drawImage(image,0,0,width,height,null);
g.dispose();
image=newImage;
returnimage;
}

/**
*旋轉90度旋轉
*
*@return對應圖片
*/
publicBufferedImagerotate(){
BufferedImagedest=newBufferedImage(height,width,
BufferedImage.TYPE_INT_ARGB);
for(inti=0;i<width;i++)
for(intj=0;j<height;j++){
dest.setRGB(height-j-1,i,image.getRGB(i,j));
}
image=dest;
returnimage;
}

/**
*合並兩個圖像
*
*@paramanotherImage
*另一張圖片
*@return合並後的圖片,如果兩張圖片尺寸不一致,則返回null
*/
publicBufferedImagemergeImage(BufferedImageanotherImage){

intw=anotherImage.getWidth();
inth=anotherImage.getHeight();
if(w!=width||h!=height){
returnnull;
}

for(inti=0;i<w;i++){
for(intj=0;j<h;j++){
intrgb1=image.getRGB(i,j);
intrgb2=anotherImage.getRGB(i,j);

Colorcolor1=newColor(rgb1);
Colorcolor2=newColor(rgb2);

//如果該位置兩張圖片均沒有字體經過,則跳過
//如果跳過,則最後將會是黑色背景
if(color1.getRed()+color1.getGreen()+color1.getBlue()
+color2.getRed()+color2.getGreen()
+color2.getBlue()==0){
continue;
}

Colorcolor=newColor(
(color1.getRed()+color2.getRed())/2,
(color1.getGreen()+color2.getGreen())/2,
(color1.getBlue()+color2.getBlue())/2);
image.setRGB(i,j,color.getRGB());
}
}
returnimage;
}

/**
*保存圖片intrgb1=image.getRGB(i,j);intrgb2=anotherImage.getRGB(i,j);
*rgb2=rgb1&rgb2;image.setRGB(height-i,j,rgb2);
*
*@paramfilePath
*圖片路徑
*/
publicvoidsave(StringfilePath){
try{
ImageIO.write(image,"png",newFile(filePath));
}catch(IOExceptione){
e.printStackTrace();
}
}

/**
*得到對應的圖片
*
*@return
*/
publicBufferedImagegetImage(){
returnimage;
}
}

❷ 手機圖片如何添加豎式文字怎麼添加豎式文字

手機中,編輯圖片時,通過調整文本框的寬度,可以讓文字變成豎排的效果。

不過,我試了一下,不是所有手機圖片 APP 都能做到,這里推薦一款 APP ——Adobe Photoshop Express

❸ 美圖秀秀怎麼把字做成豎著的

點「輸入靜態文字」

然後打一個字按一下回車,再打一個再按回車。

望採納!

閱讀全文

與豎文字生成圖片相關的資料

熱點內容
可愛美女cp圖片 瀏覽:6
俏女圖片可愛 瀏覽:850
女孩疊被子卡通圖片 瀏覽:915
純粹圖片文字日記本免費下載 瀏覽:945
可愛奶貓穿衣服圖片 瀏覽:221
如何辨別小孩感冒圖片 瀏覽:645
淡黃短褲發型圖片 瀏覽:125
帶著小黃人帽子的可愛圖片 瀏覽:290
馬頭人身的文字圖片 瀏覽:51
笑一笑文字圖片 瀏覽:816
水鑽衣服圖片 瀏覽:828
女生海邊氣質唯美意境圖片 瀏覽:655
美女受刑的圖片 瀏覽:626
女生霸氣卡通圖片超拽 瀏覽:820
word轉pdf後圖片大小 瀏覽:322
男生雙手比心正面圖片 瀏覽:262
如何根據款號快速插入圖片 瀏覽:375
小清新手繪女孩頭像圖片 瀏覽:864
圖片表格文字提取軟體 瀏覽:8
女孩尿褲子圖片 瀏覽:481