在我的应用程序中,我从相机拍摄照片,然后我得到该图片在相同的图片上做一些图像处理操作,但当我得到这个图片与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) 我希望我的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.
有谁知道我应该做什么?
我正在开发一个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) 我已经看过很多样本,开发人员调用recycle()位图,然后将其设置为null.为什么这是必要的,垃圾收集器是否负责释放位图?
Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
bitmap.recycle();
bitmap = null;
Run Code Online (Sandbox Code Playgroud) 我想实现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
我已经阅读了许多关于解码位图的内存分配问题的相关帖子,但即使在使用官方网站提供的代码后仍然无法找到解决以下问题的方法.
这是我的代码:
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) 我刚遇到一个问题; 在伪代码中很容易解决,但是当我开始在java中编码时; 我开始意识到我不知道从哪里开始......
这是我需要做的:
我正试图在我的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应用程序,帮助用户通过草绘或绘图复制位图的一部分.我的意思是用户将在Canvas上绘制一些具有位图作为背景的形状,然后我将这些点着色为位图(位矩阵/ 2D位阵列).直到这里每个人都听起来不错.
现在的问题是如何复制矩阵中具有相应真位的图像部分?
1)主图像:
2)图像作为画布背景:
3)画布上的一些画作:
4)绘制区域的位矩阵表示:
5)预期产出: