bitmap

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

匆匆过客 提交于 2020-01-02 07:06:11
问题 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

Find the position of a bitmap in android imageview when container view scaled centerInside

谁说我不能喝 提交于 2020-01-02 06:06:59
问题 I have an RelativeLayout that contains a custom ImageView, the scaleType="centerInside", I load in a bitmap (usually smaller than the imageView). How can I get the top/left position of where the bitmap was drawn? I need to be able addView's on top a positions relative to the bitmap. RelativeLayout view = (RelativeLayout) inflater.inflate(R.layout.scroll_scaled, container, false); ContentImageView image = (ContentImageView) view.findViewById(R.id.base_page); Bitmap bm = mInterfaceActivity

Bitmap Graphics vs WinForm Control Graphics

情到浓时终转凉″ 提交于 2020-01-02 05:27:09
问题 I'm just using a .NET port of Pdfium named PdfiumViewer. It just works very well once rendered in the WinForm controls but when I try to render it on a Bitmap to show in the WPF windows (or even saving to disk) the rendered text has problem. var pdfDoc = PdfiumViewer.PdfDocument.Load(FileName); int width = (int)(this.ActualWidth - 30) / 2; int height = (int)this.ActualHeight - 30; var bitmap = new System.Drawing.Bitmap(width, height); var g = System.Drawing.Graphics.FromImage(bitmap); g

Creating BitmapImage on background thread WP7

≡放荡痞女 提交于 2020-01-02 05:19:08
问题 I'm receiving an UnauthorizedAccessException ("Invalid cross-thread access.") when running the following code on a background (threadpool) thread, is this expected behaviour? var uri = new Uri("resourcevault/images/defaultSearch.png", UriKind.Relative); var info = Application.GetResourceStream(uri); // this line throws exception.... this.defaultSearchImage = new BitmapImage(); 回答1: The reason is because your background thread cannot directly be used to update the UI. Instead, you need to use

Get size of Bitmap Android [duplicate]

亡梦爱人 提交于 2020-01-02 01:03:23
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Bitmap byte-size after decoding? Is there anyway so I can get the size of this Bitmap?I've tried to use getByteCount() but I can't use it? Bitmap bitmap = BitmapFactory.decodeByteArray(decryptedData , 0, decryptedData .length); //decoding bytearrayoutputstream to bitmap Any suggestions? 回答1: As you can see from the API, you can use getWidth() getHeight() for the size of the Bitmap in pixels. And if it is an

Saving an image from ImageView into internal storage

别等时光非礼了梦想. 提交于 2020-01-01 19:56:46
问题 I have created an ImageView and I can see the preview of the Camera and load the captured image into the ImageView and I wanted to store the image into a directory in my internal memory. I have referred many posts and tried but I couldn't find my image in my internal memory. This is the code I have used: package com.example.shravan.camera; import android.content.Context; import android.content.ContextWrapper; import android.content.Intent; import android.content.pm.PackageManager; import

Bitmap Channels order different in Android

泄露秘密 提交于 2020-01-01 19:13:50
问题 I got a problem with an Air Native Extension in Android. The ANE receive a Bitmap from the Actionscript side, compress it in jpeg format and send it back to the Actionscript that will write it on the storage. Everything is good but one last thing. It seems that the channels order for Actionscript is different than in Android, so my compressed image have RED colors in place of BLUE.. here is the code: Actionscript (I'm using a library called deng.fzip.FZipLibrary to get the bitmap from a zip

Bitmap rendering methodology in OpenGL?

大兔子大兔子 提交于 2020-01-01 18:59:11
问题 I've been working on a bit of a bitmap parser lately in pure C just to understand the low level workings of simpler image formats. So far, using Wikipedia's article on bitmap files, I've been able to (what I think at least) parse the information correctly - at least, most of it. The problem is that I'm not quite sure what to do from there: since I've been working with a 3.1 context, I have access to many more modernized features which is nice, albeit I'm still lost. I have a window setup with

How to rotate the image without changing its size?

人盡茶涼 提交于 2020-01-01 18:54:33
问题 I am developing an android app where I have to rotate a circular image around another circular image, but when I am running this the size of my circular image gets automatically changing continuously. So please help me how to solve this. Here is my code public class JobSearch extends Activity implements OnTouchListener { private ImageView dialer; private float y=0; public boolean onTouch(View v, MotionEvent event) { double r=Math.atan2(event.getX()-dialer.getWidth()/2, dialer.getHeight()/2

How to rotate the image without changing its size?

試著忘記壹切 提交于 2020-01-01 18:53:49
问题 I am developing an android app where I have to rotate a circular image around another circular image, but when I am running this the size of my circular image gets automatically changing continuously. So please help me how to solve this. Here is my code public class JobSearch extends Activity implements OnTouchListener { private ImageView dialer; private float y=0; public boolean onTouch(View v, MotionEvent event) { double r=Math.atan2(event.getX()-dialer.getWidth()/2, dialer.getHeight()/2