How to add text to image and save as new image

from stackoverflow

1. I’m trying to create an Android app that adds a random quote to images.

The general process is this:

  1. Start from a custom given image that shows when starting the app.
  2. From this image all the user can do is tap on it and generate a new random “quote” that get overlaid on the image.
  3. The user can save the newly created image with the quote he chose and set it as wallpaper.

I have got to the point where I can display the image in an ImageView. My list of quotes is stored in my strings.xml file.

Does anyone know how to put text underneath each image in a gridview?

You could use a TextView with a CompoundDrawable on top.

3. I’m trying to make an app for create custom cards. I’d like to add some text over a custom background (a jpg image). What is the best way of doing it? I’d need to show the user a preview of the card before send it to the server.

Editing here will involve many options like painting eye brows, changing face color, applying lipstick of different colors in lips, applying eye liner, changing hair style etc.

4. Android开发经验之在图片上随意点击移动文字

5. 得到EditText里面的内容,然后绘制在一张图片上,图片的布局控件是ImageView,但是ImageView我不知道怎么往它绘制文字,然后图片和文字合成一张图片

Bitmap b = Bitmap.createBitmap(320, 480, Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(b);
//要在这个图上画文字
Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.icon);
c.drawBitmap(bitmap, 0, 0, null);
c.drawText(“hello,text”, 0, 0, new Paint());.

方法就是drawImage(),具体的做法就是: 需要写的字转换成Image,使用drawImage()函数,把生成的Image画到指定的位置就可以了

我图片是从后台取到的然后显示在imageview上,我想在显示的图片上添加一些文字信息,如数字编号,但是这些编号是唯一的(同一张图片会多次显示,但编号不一样),和添加水印有点像,最后我要保存这些带有编号的图片到手机SD卡上,请问android中能实现图片上加文字信息这功能吗?如果可以,要通过什么方法?

contentLayout.setDrawingCacheEnabled(true);
contentLayout.measure(
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED),
MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
contentLayout.layout(0, 0, contentLayout.getMeasuredWidth(),
contentLayout.getMeasuredHeight());
contentLayout.buildDrawingCache();
Bitmap bitmap= contentLayout.getDrawingCache();

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

生活在西班牙

自己动手丰衣足食

BlueAsteroid

Just another WordPress.com site

Jing's Blog

Just another WordPress.com site

Start from here......

我的心情魔方

天才遠私廚

希望能做一個分享各種資訊的好地方

语义噪声

西瓜大丸子汤的博客

笑对人生,傲立寰宇

Just another WordPress.com site

Where On Earth Is Waldo?

A Project By Melanie Coles

the Serious Computer Vision Blog

A blog about computer vision and serious stuff

Cauthy's Blog

paper review...

Cornell Computer Vision Seminar Blog

Blog for CS 7670 - Special Topics in Computer Vision

datarazzi

Life through nerd-colored glasses

Luciana Haill

Brainwaves Augmenting Consciousness

槑烎

1,2,∞

Dr Paul Tennent

and the university of nottingham

turn off the lights, please

A bunch of random, thinned and stateless thoughts around the Web

%d bloggers like this: