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

豎文字生成圖片

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

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

點「輸入靜態文字」

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

望採納!

閱讀全文

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

熱點內容
心痛女孩子的動態圖片 瀏覽:47
女孩白色內內圖片 瀏覽:70
入冬早上好文字圖片 瀏覽:516
帥氣男生換裝圖片 瀏覽:108
短發面條卷發型圖片 瀏覽:900
可愛小孩子圖片賣萌 瀏覽:538
花的圖畫手繪簡單圖片 瀏覽:662
動漫公主服裝圖片大全圖片大全 瀏覽:61
動漫繪畫作品圖片 瀏覽:34
小女孩幾幾的現狀圖片 瀏覽:153
櫻花圖片動漫圖 瀏覽:646
成熟潮男搭配衣服圖片 瀏覽:61
動漫人物圖片大全黑白 瀏覽:984
最多動漫圖片 瀏覽:743
小鳥衣服圖片大全可愛 瀏覽:415
手擋太陽的圖片女生 瀏覽:453
男女生圖片背影圖片 瀏覽:985
想太多心會累文字圖片 瀏覽:333
簡單動漫圖片教程視頻 瀏覽:519
女孩發育圖片視頻 瀏覽:521