bitmap

Saving a bitmap into a MemoryStream

限于喜欢 提交于 2020-01-12 06:28:30
问题 Should I allocate the memory or just the object of the memory stream: Is this OK? MemoryStream memoryStream = new MemoryStream(); bitmap.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Jpeg); If I need to define the MemoryStream size, how can I get it from Bitmap? 回答1: .NET is a managed environment: specifically, memory allocation is usually managed on your behalf by the .NET runtime. You don't typically need to allocate the memory yourself. Sometimes, however, you do need to inform the

Use MediaCodec and MediaExtractor to decode and code video

妖精的绣舞 提交于 2020-01-12 03:57:06
问题 I need to decode a video into a sequence of bitmaps, such that I am able to modify them, and then compress them back to a video file in android. I plan to manage this by using getFrameAtTime and saving it to an image sequence. Then I can modify images in the sequence and code it back to a movie. But I have two problem with this: First, as I read it, the getFrameAtTime is for creating thumbnails and will not guarantee returning the correct frame. This makes the video laggy. Secondly, saving

get bitmap from visible zoomed image android

别来无恙 提交于 2020-01-12 03:30:08
问题 I have an Imageview which is zoomed and rotated(I have used multitouch zooming ). So how can i get bitmap of only visible content(I mean when i zoom the image , The part of the bitmap may go out of the screen. So, what i want is the bitmap that is visible on the screen). So is there any built in feature in api to create a small bitmap from a big one? or Is there any function to crop the image using x,y coordinates? actually i want the zoomed or rotated part to go to the next activity 回答1: If

OutOfMemory error though free memory is available

有些话、适合烂在心里 提交于 2020-01-12 03:13:25
问题 I'm seeing a pretty odd problem. Essentially sometimes large bitmap memory allocations will fail even though there's apparently tons of memory. There are a number of posts that appear to ask a similar question but they are all related to pre-honeycomb android. My understanding is that images are allocated on heap now, instead of some outside memory. Anyway, please look at this log below: 10-14 13:43:53.020: INFO/dalvikvm-heap(31533): Grow heap (frag case) to 40.637MB for 942134-byte

8583解析类

偶尔善良 提交于 2020-01-12 02:12:13
ISO8583报文是一种标准报文格式,主要用于金融等领域,网上有很多讲解此报文的文章,需要使用的可以查资料看一下,这里就不浪费空间了。 下面贴出读写该报文的类,需者自取! /* ISO8583.h */ /* Create by jojoke */ #ifndef __ISO_8583_H__ #define __ISO_8583_H__ #include < map > using namespace std; typedef struct { int bit_flag; /* 域数据类型0 -- string, 1 -- int, 2 -- binary */ char * data_name; /* 域名 */ int length; /* 数据域长度 */ int length_in_byte; /* 实际长度(如果是变长) */ int variable_flag; /* 是否变长标志0:否 2:2位变长, 3:3位变长 */ int datatype; /* 0 -- string, 1 -- int, 2 -- binary */ char * data; /* 存放具体值 */ int attribute; /* 保留 */ } ISO8583Field; typedef struct { int len; BYTE * data; }

Android Widget Bitmap Sizes

半城伤御伤魂 提交于 2020-01-11 19:54:33
问题 Hallo, I am writing a widget, but am unsure what size bitmap to use as a background for each screen resolution/density. According to the Android Developer App Widgets tutorial: To find your minimum width and height in density-independent pixels (dp), use this formula: (number of cells * 74) - 2 Following this formula, you should use 72 dp for a height of one cell, 294 dp and for a width of four cells So if my widget is 72dp x 294dp, what size bitmaps do I need for my ldpi, mdpi and hdpi

Android Widget Bitmap Sizes

為{幸葍}努か 提交于 2020-01-11 19:53:02
问题 Hallo, I am writing a widget, but am unsure what size bitmap to use as a background for each screen resolution/density. According to the Android Developer App Widgets tutorial: To find your minimum width and height in density-independent pixels (dp), use this formula: (number of cells * 74) - 2 Following this formula, you should use 72 dp for a height of one cell, 294 dp and for a width of four cells So if my widget is 72dp x 294dp, what size bitmaps do I need for my ldpi, mdpi and hdpi

Too much memory consumption while converting image between wpf and gdi+

不打扰是莪最后的温柔 提交于 2020-01-11 13:05:07
问题 I am expecting too much memory consumption while converting an TransformedBitmap to a System.Drawing.Bitmap. The Image ist quite big with 7360x4912 pixel with a BGR32 Pixelformat which adds up to 144609280 bits ~ 138MB. Initially I load the image from hard drive into a BitmapImage. Then rotate it with RotateTransform to end up with a final TransformedBitmap (WPF). For Imageprocessing with EmguCV I will need System.Drawing.Bitmap. I convert the TransformedBitmap using the following function:

Too much memory consumption while converting image between wpf and gdi+

。_饼干妹妹 提交于 2020-01-11 13:05:03
问题 I am expecting too much memory consumption while converting an TransformedBitmap to a System.Drawing.Bitmap. The Image ist quite big with 7360x4912 pixel with a BGR32 Pixelformat which adds up to 144609280 bits ~ 138MB. Initially I load the image from hard drive into a BitmapImage. Then rotate it with RotateTransform to end up with a final TransformedBitmap (WPF). For Imageprocessing with EmguCV I will need System.Drawing.Bitmap. I convert the TransformedBitmap using the following function:

Cannot read BITMAPFILEHEADER of a bitmap file using C++ [duplicate]

二次信任 提交于 2020-01-11 11:27:09
问题 This question already exists : I am getting BITMAP filesize 0 everytime [duplicate] Closed 5 years ago . I am trying to read the FILEHEADER and INFOHEADER of a bitmap file, but I am unable to do so. I am getting Segmentation Fault . My code has been given below. #include <bits/stdc++.h> using namespace std; typedef int LONG; typedef unsigned short WORD; typedef unsigned int DWORD; struct BITMAPFILEHEADER { WORD bfType; DWORD bfSize; WORD bfReserved1; WORD bfReserved2; DWORD bfOffBits; };