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

豎文字生成圖片

發布時間: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

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

點「輸入靜態文字」

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

望採納!

閱讀全文

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

熱點內容
男生難過圖片大全 瀏覽:867
照片轉動漫圖片的軟體 瀏覽:850
丁氏文字圖片 瀏覽:948
肥料的種類圖片價格 瀏覽:197
長臉男童發型圖片大全短發 瀏覽:863
耐克冬季衣服圖片 瀏覽:597
如何去除圖片灰度後列印 瀏覽:32
芭比的衣服裙子圖片 瀏覽:389
高清膜圖片 瀏覽:144
超級暖心的男生圖片 瀏覽:968
憤怒的小鳥圖片可愛 瀏覽:4
如何掛皮影圖片 瀏覽:845
word圖片排版各種熱鍵 瀏覽:82
學前減齡發型圖片 瀏覽:330
可愛叮當貓圖片大全 瀏覽:529
女生腰上系紅繩圖片 瀏覽:309
筆記本如何設置電腦的圖片鎖 瀏覽:480
修改word中所有圖片尺寸 瀏覽:435
用圖片如何搜人 瀏覽:456
山水風景圖片怎麼p 瀏覽:944