android-image

How to convert Image to PDF?

吃可爱长大的小学妹 提交于 2019-11-28 06:03:46
I am developing an application where I need to convert an Image to PDF. I tried something, but the issue is, Image size in that PDF is very very small. I need solution to fix this. Also I am looking for converting multiple Images into single PDF document. I will post the code which I tried. public void convertPDF(byte[] path) { String FILE = "mnt/sdcard/FirstPdf.pdf"; Document document=new Document(); try { PdfWriter.getInstance(document, new FileOutputStream(FILE)); document.open(); try { image=Image.getInstance(path); document.add(new Paragraph("My Heading")); document.add(image); document

How to display an image from an URL within textView

烈酒焚心 提交于 2019-11-28 05:40:39
问题 I have a textView. In my code I am adding some lines of text in it. I also want to display some image from an external URL (not from my resource folder) just in between those lines. Every thing is dynamic i.e. the text generated and the image URL will be generated on the flow.So i have to fetch the image through my code and add it. Wondering if there is a way to insert images from external URL within text view? Also any better approach is always welcome. 回答1: You will have to use this along

How to apply different image effects (filters) on bitmap like sepia, black and white, blur, etc.?

旧时模样 提交于 2019-11-28 04:47:15
I am not having any idea of how to apply different effect on Image, I have seen the EffectFactory class and Effect class in effect class there is one method apply but I am not sure what to pass in inputTexId and optputTexId, and from where I get the new updated image, how to store the updated image in imageView, Please help me with how to approach this problem. Is there any opensource library available for providing effects on Image. Thanks, I have implemented Jerry's Java Image Processing Library . Works fine for me. Download AndroidJars . Edit Bitmap bitmap = BitmapFactory.decodeResource

How to get Coordinates on touch Event on bitmap not of Screen

坚强是说给别人听的谎言 提交于 2019-11-28 01:59:23
问题 Greets , How can I get the Coordinates of the Bitmap not of the screen. Screen Coordinates got by event.getX(),event.getY() methods but not getting coordinates of the bitmap. Please help anyone. 回答1: You can't get the coordinates of the bitmap directly. You need to calculate to yourself. Use the position of the ImageView, and with that you can handle it. Of course, when you are after Activity onCreate you can acces to any inflated (active) views parameter. Exemple. ImageView a; a

decodeStream returns null

拈花ヽ惹草 提交于 2019-11-28 01:59:04
问题 I'm trying to adopt bitmap resizing tutorial - the only difference is that I use decodeStream instead of decodeResource. It's strange but decodeStream, without any manipulations, gives me a bitmap obj, but when I go through decodeSampledBitmapFromStream it returns null for some reason. How do I fix it ? Here's the code I use: protected Handler _onPromoBlocksLoad = new Handler() { @Override public void dispatchMessage(Message msg) { PromoBlocksContainer c = (PromoBlocksContainer)

Disable Android resource / image / PNG optimization

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 20:43:11
问题 How do I prevent the Android "build process" from optimizing .png images? I have an Android project with the following res directories: - /res/ - /res/drawable - /res/drawable-hdpi - /res/drawable-hdpi-v5 - /res/drawable-ldpi - /res/drawable-ldpi-v5 - /res/drawable-mdpi - /res/drawable-mdpi-v5 These directories contain many .png files . I optimize PNG sizes with PNGOUTWin, and the overall size is reduced by more than 20%. When I build the .apk file, the images are "optimized" by the build

Rotate a saved bitmap in android

一笑奈何 提交于 2019-11-27 20:19:06
I am saving an image from the camera that was in landscape mode. so it gets saved in landscape mode and then i apply an overlay onto it that too is in landscape mode. I want to rotate that image and then save. e.g. if i have this I want to rotate clockwise by 90 degrees once and make it this and save it to sdcard: How is this to be accomplished? void rotate(float x) { Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(),R.drawable.tedd); int width = bitmapOrg.getWidth(); int height = bitmapOrg.getHeight(); int newWidth = 200; int newHeight = 200; // calculate the scale - in this case

How to get a Bitmap from a raw image

空扰寡人 提交于 2019-11-27 15:12:29
问题 I am reading a raw image from the network. This image has been read by an image sensor, not from a file. These are the things I know about the image: ~ Height & Width ~ Total size (in bytes) ~ 8-bit grayscale ~ 1 byte/pixel I'm trying to convert this image to a bitmap to display in an imageview. Here's what I tried: BitmapFactory.Options opt = new BitmapFactory.Options(); opt.outHeight = shortHeight; //360 opt.outWidth = shortWidth;//248 imageBitmap = BitmapFactory.decodeByteArray(imageArray,

Remove the SearchIcon as hint in the searchView

孤街浪徒 提交于 2019-11-27 14:17:47
I am doing an application where for example when i click on the image(it is a searchView) the search pad opens ! and it looks like but here the default search icon (magnifier) gets displayed but this dissappears as soon as some text is entered but i dont want that magnifier to be displayed even the image is clicked for the first time and here i am not using any xml file my code is public class MainActivity extends Activity { @SuppressLint("NewApi") @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); RelativeLayout relative = new RelativeLayout

How to store an image in the database android [duplicate]

萝らか妹 提交于 2019-11-27 13:20:38
问题 This question already has answers here : How to save images into Database (3 answers) Closed 6 years ago . I am new to android and I am creating a contact manager. I have worked out how to store the values from EditText fields into the database but I don't know how to store an image in the database. I was wondering if someone could help me with this. package awad865.project.ContactManager1; import java.io.FileNotFoundException; import java.io.InputStream; import android.app.Activity; import