标签: bitmap

data.getExtras().get("data")android中低分辨率图像的结果

在我的应用程序中,我从相机拍摄照片,然后我得到该图片在相同的图片上做一些图像处理操作,但当我得到这个图片与data.getExtras().get("数据"),图片来了低分辨率而不是真正的决议.这个问题可能是什么原因?

代码就是这样;

    Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
          startActivityForResult(intent , CAMERA_PIC_REQUEST);
    }

    protected void onActivityResult(int requestCode , int resultCode , Intent data )
    {
        if( requestCode != 0)
        { 
            ImageView image = (ImageView)findViewById(R.id.imageView1);
                thumbnail = (Bitmap)data.getExtras().get("data");
Run Code Online (Sandbox Code Playgroud)

android image bitmap android-intent

13
推荐指数
2
解决办法
1万
查看次数

接收从Web页面拖动到WPF窗口的图像

我希望我的WPF应用程序成为放置目标,我希望能够从任何网页拖动图像.

当从网页拖动图像时,显然它是"DragImageBits"格式,可以反序列化以键入ShDragImage.(请参阅问题的底部,了解我如何定义它)

如何将其转换为WPF图像?

这是我目前的尝试.(如果有人知道做出绝望的正确方法,我全都耳朵)

   private void UserControl_Drop(object sender, System.Windows.DragEventArgs e)
    {

            string[] formats = data.GetFormats();

            // DragImageBits
            if (formats.Contains("DragImageBits"))
            {
            MemoryStream imageStream = data.GetData("DragImageBits") as MemoryStream;

            // Now I'm deserializing this, the only way I know how
            imageStream.Seek(0, SeekOrigin.Begin);
            BinaryReader br = new BinaryReader(imageStream);

            ShDragImage shDragImage;
            shDragImage.sizeDragImage.cx = br.ReadInt32();
            shDragImage.sizeDragImage.cy = br.ReadInt32();
            shDragImage.ptOffset.x = br.ReadInt32();
            shDragImage.ptOffset.y = br.ReadInt32();
            shDragImage.hbmpDragImage = new IntPtr(br.ReadInt32());
            shDragImage.crColorKey = br.ReadInt32();


            var systemDrawingBitmap = System.Drawing.Bitmap.FromHbitmap(shDragImage.hbmpDragImage);
Run Code Online (Sandbox Code Playgroud)

在这一点上,我得到一个类型的例外,System.Runtime.InteropServices.ExternalException消息就是这样Generic GDI+ error.

有谁知道我应该做什么?


以下是支持类定义.我从 …

.net wpf drag-and-drop bitmap winforms

13
推荐指数
1
解决办法
2683
查看次数

SQLite - 是否可以通过insert语句插入BLOB?

我正在开发一个Android应用程序,我正在使用Sqlite数据库来存储一些位图.我希望在用户安装应用程序时自动插入一些图像.

我正在使用SQLiteOpenHelper类,如下所示:

public class DatabaseHelper extends SQLiteOpenHelper {

...

DatabaseHelper(Context context, String nameOfDB, int version, String[] scriptSQLCreate,
        String scriptSQLDelete) {
    super(context, nameOfDB, null, version);

    this.scriptSQLCreate = scriptSQLCreate;
    this.scriptSQLDelete = scriptSQLDelete;
}

@Override
public void onCreate(SQLiteDatabase db) {
    int numScripts = scriptSQLCreate.length;
    for(int i = 0; i<numScripts; i++){
    Log.i(TAG,"Creating database, executing script " + i);
    db.execSQL(scriptSQLCreate[i]);
    }
}
}
Run Code Online (Sandbox Code Playgroud)

...

我想将一个常量传递给上面显示的scriptSQLCreate参数,如下所示:

private static final String[] SCRIPT_DATABASE_CREATE = {
   "create table memes(  id integer primary key autoincrement," + 
                     + " …
Run Code Online (Sandbox Code Playgroud)

database sqlite android blob bitmap

13
推荐指数
1
解决办法
3万
查看次数

Android - 位图和内存管理?

我已经看过很多样本,开发人员调用recycle()位图,然后将其设置为null.为什么这是必要的,垃圾收集器是否负责释放位图?

Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
bitmap.recycle();
bitmap = null;
Run Code Online (Sandbox Code Playgroud)

android garbage-collection bitmap

13
推荐指数
1
解决办法
1万
查看次数

什么是灰度图像的BMP格式?

什么是灰度图像的BMP格式(特别是每像素16位)?在维基百科刚刚谈到的彩色图像为BMP.

更新:

只是为了更新和未来访问者的信息,我将选择PGM,因为它是未压缩的,可以支持16位灰度.另一种选择是使用PNG,但压缩数据(这不是我想要的)的讨论在这里.另请注意,图像可能会显得失真,因为大多数显示器支持256色而不支持4096(16位).所以图像会饱和.

令人惊讶的是,在16位图像的灰度级情况下,BMP 几乎无能为力.
感谢帮助我理解这个问题的人.

file-format image bitmap

13
推荐指数
1
解决办法
3万
查看次数

android NDK中的颜色叠加

我想实现Hue /颜色/饱和度颜色叠加.我看到了宏:

#define ColorBlend_Saturation(T,A,B) ColorBlend_Hls(T,A,B,HueA,LuminationA,SaturationB)
Run Code Online (Sandbox Code Playgroud)

我试图在Adobe Photoshop中使用颜色重现它#332244并#557711获得结果颜色 - #431076.然而,应用这些宏后,我得到了颜色 - #320C59结果.

问题1:如何重现色情,饱和度和颜色的photoshop算法?

问题2:如何调整alpha通道?例如,在我的颜色和光学== 50,这应该在Photoshop - #3b195d

c++ android bitmap android-ndk

13
推荐指数
1
解决办法
817
查看次数

尽管使用了减少的样本大小,但BitmapFactory.decodeStream内存不足

我已经阅读了许多关于解码位图的内存分配问题的相关帖子,但即使在使用官方网站提供的代码后仍然无法找到解决以下问题的方法.

这是我的代码:

public static Bitmap decodeSampledBitmapFromResource(InputStream inputStream, int reqWidth, int reqHeight) {

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    byte[] buffer = new byte[1024];
    int len;
    try {
        while ((len = inputStream.read(buffer)) > -1) {
        baos.write(buffer, 0, len);
        }
        baos.flush();
        InputStream is1 = new ByteArrayInputStream(baos.toByteArray());
        InputStream is2 = new ByteArrayInputStream(baos.toByteArray());

        final BitmapFactory.Options options = new BitmapFactory.Options();
        options.inJustDecodeBounds = true;
        BitmapFactory.decodeStream(is1, null, options);

        options.inSampleSize = calculateInSampleSize(options, reqWidth, reqHeight);
        options.inPurgeable = true;
        options.inInputShareable = true;
        options.inJustDecodeBounds = false;
        options.inPreferredConfig = Bitmap.Config.ARGB_8888;
        return BitmapFactory.decodeStream(is2, null, …
Run Code Online (Sandbox Code Playgroud)

android bitmap out-of-memory

13
推荐指数
2
解决办法
2万
查看次数

java - 如何创建和操作长度为1000万位的位数组

我刚遇到一个问题; 在伪代码中很容易解决,但是当我开始在java中编码时; 我开始意识到我不知道从哪里开始......

这是我需要做的:

  1. 我需要一个大小为1000万(位)的位数组(让我们称之为A).
  2. 我需要能够将此数组中的元素设置为1或0(A [99000] = 1).
  3. 我需要遍历1000万个元素.

java bitmap

13
推荐指数
2
解决办法
3万
查看次数

使用Facebook的Fresco加载位图

我正试图在我的Android应用程序中用Fresco替换Picasso.但是我不确定如何使用Fresco简单地加载位图.

毕加索我会做以下几点.

Bitmap poster = Picasso.with(getActivity())
                    .load(url)
                    .resize(Utils.convertDpToPixel(WIDTH,HEIGHT))
                    .centerCrop()
                    .get();
Run Code Online (Sandbox Code Playgroud)

我一直无法弄清楚如何用这个Fresco创建一个Bitmap.有任何想法吗?

android facebook bitmap picasso fresco

13
推荐指数
2
解决办法
2万
查看次数

从ANDROID编程中的位图图像复制位矩阵

我正在开发一个Android应用程序,帮助用户通过草绘或绘图复制位图的一部分.我的意思是用户将在Canvas上绘制一些具有位图作为背景的形状,然后我将这些点着色为位图(位矩阵/ 2D位阵列).直到这里每个人都听起来不错.

现在的问题是如何复制矩阵中具有相应真位的图像部分?

补充说明

1)主图像:

任何过程都需要图像

2)图像作为画布背景:

图像作为画布背景

3)画布上的一些画作:

用户在画布上绘画

4)绘制区域的位矩阵表示:

位矩阵

5)预期产出:

输出的地方在哪里

android bitmap matrix

13
推荐指数
1
解决办法
1133
查看次数