bitmap

Dealing with large bitmap onPictureTaken android

女生的网名这么多〃 提交于 2020-01-02 23:50:34
问题 My app is an OCR app base on Tesseract. It will do OCR task from camera picture. Users can take many pictures and put them into an OCR queue. To get more accuracy, I want to keep high quality image (I choose min size is 1024 x 768 (maybe larger in future), JPEG, 100% quality). When users take many pictures, there are three things to do: Save the image data byte[] to file and correct EXIF. Correct the image orientation base on device's orientation. I know there are some answers that said the

How to set dpi image when saving it from bitmap in Android?

﹥>﹥吖頭↗ 提交于 2020-01-02 18:53:23
问题 I use this function to save bitmap to file on sdcard: private static File storeImage(Context context, Bitmap image) { File pictureFile = getOutputMediaFile(context); if (pictureFile == null) { return null; } try { FileOutputStream fos = new FileOutputStream(pictureFile); image.compress(Bitmap.CompressFormat.PNG, 100, fos); fos.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return pictureFile; } private static File

ComboBox Simple with Bitmap

懵懂的女人 提交于 2020-01-02 14:32:19
问题 How do I put a bitmap in a combobox with style set to simple? For example, Google Chrome has the star on the right, Firefox has the arrow on the right. I tried this code: procedure TForm2.ComboBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); var ComboBox: TComboBox; bitmap: TBitmap; begin ComboBox := (Control as TComboBox); Bitmap := TBitmap.Create; try ImageList1.GetBitmap(0, Bitmap); with ComboBox.Canvas do begin FillRect(Rect); if Bitmap.Handle <> 0

Problems setting bitmaps to Static Control MFC

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-02 12:52:13
问题 I'm currently fighting with a dialog based GUI, while trying to customize it. I have drawn some bitmaps which I would like to use as buttons and as logos in the dlg. I have written two member functions, one for setting bitmaps to CButton s, and one for setting bitmaps to CStatic s. Actually both are working, when calling them on button press. But only the member-function for setting the CButton s works properly during the initialisation of the dialog. My CStatic s are getting overwritten

cursor.getString returns null with a valid uri

大憨熊 提交于 2020-01-02 10:23:11
问题 All of a sudden the program has stopped working. I have a URI: " content://com.android.providers.media.documents/document/image%3A13 ", a file path to an image. The path for the URI is chosen like so: protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if(resultCode == RESULT_OK) { try { // This bit here Bitmap bitmap = getPath(data.getData()); Log.i("Bitmap", "Bmp: " + data.getData()); }catch (Exception e){

How can i take screenshot of rotated TextView with emoji?

守給你的承諾、 提交于 2020-01-02 09:56:23
问题 I'm trying to make a screenshot of the rotated TextView which contain emoji icons. But on resulting bitmap i see that emoji are not rotated! Why is this happening? How can i make a screenshot with rotated emoji ? What i expect: And this is what i get: I'm using this method to get screenshot of view: layout.setDrawingCacheEnabled(true); layout.buildDrawingCache(); Bitmap bitmap = null; if (layout.getDrawingCache() != null) bitmap = layout.getDrawingCache().copy(Bitmap.Config.ARGB_8888, false);

How can i take screenshot of rotated TextView with emoji?

醉酒当歌 提交于 2020-01-02 09:56:12
问题 I'm trying to make a screenshot of the rotated TextView which contain emoji icons. But on resulting bitmap i see that emoji are not rotated! Why is this happening? How can i make a screenshot with rotated emoji ? What i expect: And this is what i get: I'm using this method to get screenshot of view: layout.setDrawingCacheEnabled(true); layout.buildDrawingCache(); Bitmap bitmap = null; if (layout.getDrawingCache() != null) bitmap = layout.getDrawingCache().copy(Bitmap.Config.ARGB_8888, false);

Convert 24bpp Bitmap to 1bpp

南笙酒味 提交于 2020-01-02 08:54:59
问题 I am trying to convert a small bitmap image. I would like for any pixel that is not 100% white to be converted to black. I have tried Bitmap output = sourceImage.Clone(new Rectangle(0, 0, sourceImage.Width, sourceImage.Height), PixelFormat.Format1bppIndexed); There are still a few lighter pixels that stay white in the 1bpp output. What is the fastest way to achieve this conversion? Can I modify the intensity threshold of the call to Clone()? 回答1: Try this, from very fast 1bpp convert:

Speed - Copy bitmap data into array or work with it directly?

五迷三道 提交于 2020-01-02 07:43:08
问题 I'm using a LockedBitmap class that simplifies working with bitmap data in C#. Currently it is copying the data into a local byte[] array which is then accessed by its class methods to get/set pixel color values. Is this faster or better than accessing the locked bitmap data directly via the pointer? Is a copy needed at all? Edit: I'm not asking if its possible to directly work with bitmap data, I work with this everyday. I'm just asking for a comparison between the 2 methods and if its

Is there a faster method to convert bitmap pixels to greyscale?

自古美人都是妖i 提交于 2020-01-02 07:06:14
问题 At the moment, I am using the SetPixel() method to change the colour of every pixel in a bitmap. This works fine on small images with small dimensions, but when I test it on large images it does take a while. I haven't worked with images in VB.Net before, so I might just be overlooking something obvious. I'm doing this to make a program which converts an image to grey scale. This produces the right result but at a low speed, and during this time the UI freezes, so I'm keen to maximize the