bitmap

Maintaining Image quality when creating scaled bitmap in android

僤鯓⒐⒋嵵緔 提交于 2020-01-03 21:07:18
问题 I have an image of dimension 960x800 and I am trying to make it fill the screen. The way I have been currently doing it is by loading the full 960x800 bitmap and using source and destination Rect objects. So far example, my destination rectangle is 480x320 (the dimensions of my screen) and the source rectangle will be 960x800. background = BitmapFactory.decodeResource(getResources(), R.drawable.background, null); destRect = new Rect(0,0, screenWidth, screenHeight); sourceRect = new Rect(0,0,

write XImage to .bmp file in C

旧街凉风 提交于 2020-01-03 20:11:43
问题 I am writing an XImage to a file "bitmap0.bmp" using the following code but when i open the newly created file with imageViewer in fedora it gives "Premature end of file" error and does not display anything. could anyone please point out the problem in the following code? typedef struct tagBITMAPFILEHEADER { WORD bfType; DWORD bfSize; WORD bfReserved1; WORD bfReserved2; DWORD bfOffBits; } BITMAPFILEHEADER; typedef struct tagBITMAPINFOHEADER{ DWORD biSize; LONG biWidth; LONG biHeight; WORD

write XImage to .bmp file in C

大城市里の小女人 提交于 2020-01-03 20:11:08
问题 I am writing an XImage to a file "bitmap0.bmp" using the following code but when i open the newly created file with imageViewer in fedora it gives "Premature end of file" error and does not display anything. could anyone please point out the problem in the following code? typedef struct tagBITMAPFILEHEADER { WORD bfType; DWORD bfSize; WORD bfReserved1; WORD bfReserved2; DWORD bfOffBits; } BITMAPFILEHEADER; typedef struct tagBITMAPINFOHEADER{ DWORD biSize; LONG biWidth; LONG biHeight; WORD

Drawable loses color filter after converting into bitmap

末鹿安然 提交于 2020-01-03 20:06:05
问题 I am trying to add a color filer in a drawable and then convert it in Bitmap. The problem is when convert the drawable into bitmap it loses it's color filter.I used drawable in imageview and its have the color filter but using bitmap in imageview doesn't have any color effect. Why this happen ? Thanks in advance. 回答1: Use a canvas to blit the Drawable back onto a bitmap: Canvas canvas; Drawable drawable = <yourDrawable created from wherever>; Bitmap bmp = <your Bitmap which is the same width

Drawable loses color filter after converting into bitmap

非 Y 不嫁゛ 提交于 2020-01-03 20:04:15
问题 I am trying to add a color filer in a drawable and then convert it in Bitmap. The problem is when convert the drawable into bitmap it loses it's color filter.I used drawable in imageview and its have the color filter but using bitmap in imageview doesn't have any color effect. Why this happen ? Thanks in advance. 回答1: Use a canvas to blit the Drawable back onto a bitmap: Canvas canvas; Drawable drawable = <yourDrawable created from wherever>; Bitmap bmp = <your Bitmap which is the same width

How to dispose bitmapsource

帅比萌擦擦* 提交于 2020-01-03 18:33:36
问题 Am using BitmapSource class for reading an image from my temp folder and then reading the metadata using BitmapMetadata class. BitmapSource img = BitmapFrame.Create(new Uri(filepath)); BitmapMetadata meta = (BitmapMetadata)img.Metadata; DateTime datetaken = DateTime.Parse(meta.DateTaken); System.IO.File.Delete(filepath); While i was trying to delete the image am getting an exception saying "The process cannot access the file 'filepath/filename' because it is being used by another process.".I

Android getPixels() possibly a silly mistake?

余生颓废 提交于 2020-01-03 17:46:04
问题 Okay, this is quite simple to understand, but for some bizarre reason I can't get it working.. I've simplified this example from the actual code. InputStream is = context.getResources().openRawResource(R.raw.someimage); Bitmap bitmap = BitmapFactory.decodeStream(is); try { int[] pixels = new int[32*32]; bitmap.getPixels(pixels, 0, 800, 0, 0, 32, 32); } catch(ArrayIndexOutOfBoundsException ex) { Log.e("testing", "ArrayIndexOutOfBoundsException", ex); } Why on earth do I keep getting an

PictureBox throws “Parameter is not valid” ArgumentException upon tab keypress

谁都会走 提交于 2020-01-03 17:38:06
问题 I have a form where the user can first scan to a bitmap. When scan is done, and the bitmap is loaded, I have 4 text boxes that are then enabled. Next to each text box, I have a button called "Cut from image". When the user clicks the button, they can click and drag in the bitmap to get the selected text using MODI. This works perfect except for one annoying bug: When I click a "Cut from image" button and drag a square, it gets the information nicely to the text box. Then, if i click to the

1 image 2 links

不羁岁月 提交于 2020-01-03 13:33:05
问题 how do you make an image be clickable in in HTML in different areas of the image and lead to different URL's... for instance I have an image or "button" if you will that is 1 image but I want it to actually be 2 links... one side of the button is "sign up" while the other side is "try out" 回答1: Use CSS-sprites I think that the best way is to use CSS sprite: http://www.jsfiddle.net/pereskokov/vVhde/1/. Main benefit of using it — your image will not be a part of content, it's just decor. So

Read in JPG as RGB888 on Android

和自甴很熟 提交于 2020-01-03 13:01:18
问题 I'm trying to read in a .jpg using BitmapFactory. I want to get a RGB888 formatted bitmap, but I keep seeming to get RGB565. Is there anyway to change this? 回答1: BitmapFactory methods let you pass a BitmapFactory.Options instance. You can use BitmapFactory.Options to specifcy the inPreferredConfig, which defines the format of the Bitmap returned after decoding, just set it to Bitmap.Config.ARGB_8888. 来源: https://stackoverflow.com/questions/4866653/read-in-jpg-as-rgb888-on-android