导航:首页 > 文字图片 > 竖文字生成图片

竖文字生成图片

发布时间: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

❸ 美图秀秀怎么把字做成竖着的

点“输入静态文字”

然后打一个字按一下回车,再打一个再按回车。

望采纳!

阅读全文

与竖文字生成图片相关的资料

热点内容
手绘头像女生动漫头像图片 浏览:32
瓜子脸齐刘海发型图片 浏览:207
江西光绪元宝图片及价格 浏览:972
word转pdf图片怎么满格 浏览:62
图片作为背景插入word 浏览:724
12岁女孩学生头发型图片 浏览:595
星空伤感图片男生 浏览:892
微信朋友圈如何发四格图片 浏览:218
看男生看男生图片 浏览:177
李纯蓝色衣服图片大全 浏览:721
男老年人发型图片 浏览:830
猫的素描图片动漫 浏览:1002
淘宝买衣服图片不符 浏览:803
大腿疱疹图片大全 浏览:526
蓝色衣服搭配图片女装 浏览:171
如何设置word中全部图片大小 浏览:482
大量血的图片高清 浏览:243
一家四口长大背影可爱图片 浏览:422
戴着眼镜的男生卡通图片 浏览:260
帅气男生拿枪游戏图片 浏览:187