bitmap

How to compare Image objects with C# .NET? [closed]

孤人 提交于 2019-12-28 06:01:05
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 years ago . Can we compare two Image objects with C#? For example, check whether they are equal, or even better check how similar are their pixels? if possible, how? 回答1: You can use a set of tools called TestApi, which is an open-source library to aid unit testing. One of such API is called

How do I load and edit a bitmap file at the pixel level in Swift for iOS?

ぃ、小莉子 提交于 2019-12-28 05:46:31
问题 I want to manipulate an image at the pixel level in Swift. This question was answered for objective c: How do I access and manipulate JPEG image pixels?, but I would like to see the equivalent source for Swift. 回答1: This is how I am getting a color from an image at a touch location. I translated this answer: https://stackoverflow.com/a/12579413/359578 (This sample does no error checking for nil) func createARGBBitmapContext(inImage: CGImage) -> CGContext { var bitmapByteCount = 0 var

Android: Converting a Bitmap to a Monochrome Bitmap (1 Bit per Pixel)

ⅰ亾dé卋堺 提交于 2019-12-28 05:16:32
问题 I want to print a Bitmap to a mobile Bluetooth Printer (Bixolon SPP-R200) - the SDK doesn't offer direkt methods to print an in-memory image. So I thought about converting a Bitmap like this: Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); To a Monochrome Bitmap. I am drawing black text on above given Bitmap using a Canvas, which works well. However, when I convert the above Bitmap to a ByteArray, the printer seems to be unable to handle those bytes. I suspect I

Android: Converting a Bitmap to a Monochrome Bitmap (1 Bit per Pixel)

百般思念 提交于 2019-12-28 05:16:10
问题 I want to print a Bitmap to a mobile Bluetooth Printer (Bixolon SPP-R200) - the SDK doesn't offer direkt methods to print an in-memory image. So I thought about converting a Bitmap like this: Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); To a Monochrome Bitmap. I am drawing black text on above given Bitmap using a Canvas, which works well. However, when I convert the above Bitmap to a ByteArray, the printer seems to be unable to handle those bytes. I suspect I

绘制系列(十八)图形篇-Bitmap

冷暖自知 提交于 2019-12-28 04:17:11
图像与图形处理 Canvas中就保存着一个Bitmap对象,调用canvas的各种绘图函数,最终还是绘制到其中的Bitmap上。我们自定义View是,一般都会重写onDraw(Canvas canvas),这个函数中是自带Canvas的,只需要将画的内容调用Canvas的函数画出来,就会直接显示在对应的View上。其实,View对应着一个Bitmap,而onDraw()中canvas就是通过这个Bitmap创建出来的。 Android中:图片除了.png、.jpg等格式位图,还用资源文件中定义的Drawable对象。 1、Bitmap bitmap被称为位图,一般位图的文件格式扩展名为.bmp,作为一种逐像素显示的对象,由一个个像素点组成;因为由一个个像素组成,肯定涉及到两个问题: 如何存储每个像素 相关的像素点之间能否压缩 1.1、Bitmap在绘图中使用 转换为BitmapDrawable对象使用 BitmapDrawable drawable=new BitmapDrawable(bitmap); iv.setImageDrawable(drawable); 当做画布使用 方式一:使用默认画布 onDraw(Canvas canvas)和dispatchDraw(Canvas canvas)中的Canvas对应这一个Bitmap对象,所有的绘图都是显示这个Bitmap上的

Android SkImageDecoder::Factory returned null Error

你。 提交于 2019-12-28 04:10:36
问题 I'm trying to load an image from URL to an ImageView but the error occurs: SkImageDecoder::Factory returned null. How can I fix it? here is my code : private class LoadImageFromURL extends AsyncTask<String, Void, Bitmap>{ ImageView bitmapImgView; public LoadImageFromURL(ImageView bmImgView){ bitmapImgView = bmImgView; } @Override protected Bitmap doInBackground(String... params) { // TODO Auto-generated method stub String urlStr = params[0]; Bitmap img = null; try { URL url = new URL(urlStr);

How to programmatically change contrast of a bitmap in android?

空扰寡人 提交于 2019-12-28 03:38:13
问题 I want to programmatically change the contrast of bitmap. Till now I have tried this. private Bitmap adjustedContrast(Bitmap src, double value) { // image size int width = src.getWidth(); int height = src.getHeight(); // create output bitmap Bitmap bmOut = Bitmap.createBitmap(width, height, src.getConfig()); // color information int A, R, G, B; int pixel; // get contrast value double contrast = Math.pow((100 + value) / 100, 2); // scan through all pixels for(int x = 0; x < width; ++x) { for

How do I scale a streaming bitmap in-place without reading the whole image first?

ぃ、小莉子 提交于 2019-12-28 02:39:13
问题 I have an Android application that is very image intensive. I'm currently using Bitmap.createScaledBitmap() to scale the image to a desired size. However, this method requires that I already have the original bitmap in memory, which can be quite sizable. How can I scale a bitmap that I'm downloading without first writing the entire thing out to local memory or file system? 回答1: This method will read the header information from the image to determine its size, then read the image and scale it

How do you make sure WPF releases large BitmapSource from Memory?

≡放荡痞女 提交于 2019-12-28 02:05:09
问题 System: Windows XP SP3, .NET 3.5, 4GB RAM, Dual 1.6gHz I have a WPF application that loads and transitions (using Storyboard animations) extremely large PNGs. These PNGs are 8190x1080 in resolution. As the application runs it appears to cache the images and the system Memory slowly creeps up. Eventually it chokes the system and throws the OutOfMemoryException. Here are the steps I am currently taking to try to solve this: 1)I am removing the BitmapSource objects from the app 2)I am setting

Pixel-Perfect Collision Detection Android

本小妞迷上赌 提交于 2019-12-28 00:51:26
问题 Ok so I am working on a game on Android. I need to implement pixel perfect collision detection. I already have the bounding boxes set up around each of the images, each bounding box is transformed to match the current rotation of the image. That all works great. I also have the pixel data from each bitmap stored in an array. Can someone help me figure out the most efficient way to go about detecting if the pixels overlap? Thanks in advance for any help! 回答1: The basic idea is to create a