pixel

CSS style - percentage vs em vs px? [closed]

谁说我不能喝 提交于 2019-11-27 18:29:55
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . After reading several articles on the web I´m a bit confused about when to use percent , em or px for div´s , input´s , font´s , buttons and so on... For the site I´m working on we wan´t to add a responsive design, and from what I understand from different articles than percent is the way to go for elements and

Finding closest non-black pixel in an image fast

一笑奈何 提交于 2019-11-27 18:20:44
问题 I have a 2D image randomly and sparsely scattered with pixels. given a point on the image, I need to find the distance to the closest pixel that is not in the background color (black). What is the fastest way to do this? The only method I could come up with is building a kd-tree for the pixels. but I would really want to avoid such expensive preprocessing. also, it seems that a kd-tree gives me more than I need. I only need the distance to something and I don't care about what this something

Get pixel color from an image

◇◆丶佛笑我妖孽 提交于 2019-11-27 18:12:19
I have an image on a browser. I want to get the top left pixel of the image color (at coordinates: 0,0), no matter whether the image is rotated or not. How can I do that, using javascript or php code? Louis Ricci Create a canvas document.createElement Get the 2d context canvas.getContext('2d') Draw the image to the canvas context.drawImage(image, x, y) Make sure the image is from the same domain or you won't have access to its pixels Get the pixel data for the image context.getImageData(x1, y1, x2, y2) You want just the top left so context.getImageData(0, 0, 1, 1) The result of getImageData

setRGB() in java

a 夏天 提交于 2019-11-27 18:06:54
问题 I am using setRGB() for changing the values of the pixel of an image. int rgb=new Color(0,0,0).getRGB(); image1.setRGB(i,j,rgb); //where i,j is the boundaries of the image Here,i am setting all the pixel values with white. But the change is not getting reflected in the image. Any One knows about the setRGB() how it works? 回答1: White is in RGB 255,255,255 so: Color myWhite = new Color(255, 255, 255); // Color white int rgb = myWhite.getRGB(); try { BufferedImage img = null; try { img = ImageIO

iOS — detect the color of a pixel?

房东的猫 提交于 2019-11-27 18:03:00
For example, suppose I want to detect the color of the pixel with screen coordinates (100, 200). Is there a way to do this? EDIT -- I'm not worried about retina display issues for now. John Parker This may not be the most direct route, but you could: Use UIGraphicsBeginImageContextWithOptions to grab the screen (see the Apple Q&A QA1703 - " Screen Capture in UIKit Applications "). Then use CGImageCreateWithImageInRect to grab the portion of the resultant image you require. Finally analyse the resultant image. It gets complicated at this point, but thankfully there's an existing question that

LCD编程_画点线圆

。_饼干妹妹 提交于 2019-11-27 17:57:41
上篇博客中进行了lcd的简单测试,这篇博客将进行更加复杂的测试——画点、画线、画圆。画线和画圆是在画点的基础上实现的,因此本篇博客重点实现画点操作。 先抛出这样的一个问题,已知: (x,y)的坐标; bpp; xres; yres; 那么,如何在framebuffer中获得像素的地址呢? (x,y)像素的起始地址 = fb_base +(xres * bpp /8)* y +x * bpp/8 (xres * bpp /8)表示一行占据多少个字节,乘以y表示y行共占据多少个像素 2)在framebuffer.c中实现画点操作 1 #include "lcd.h" 2 3 /* 实现画点 */ 4 5 /* 获得LCD参数 */ 6 static unsigned int fb_base; 7 static int xres, yres, bpp; 8 9 void fb_get_lcd_params(void) 10 { 11 get_lcd_params(&fb_base, &xres, &yres, &bpp); 12 } 13 14 /* rgb: 0x00RRGGBB */ 15 unsigned short convert32bppto16bpp(unsigned int rgb) 16 { 17 int r = (rgb >> 16)& 0xff; /*将红色的值拿到*

Asp.Net Core 生成二维码(NuGet使用QRCoder)

百般思念 提交于 2019-11-27 15:20:01
前言 功能:调用web api 接口 1.获取 jpeg 格式的二维码 2.获取中间带有logo 的二维码 3. 下载 jpeg,svg 格式的二维码 需要的NuGet 包: > QRCoder(v1.3.6) > System.Drawing.Common(v4.5.1) 正文 1. 准备项目 创建ASP.NET Core Web Api 应用程序,添加上边说的两个包,并创建Services 文件夹,Services 文件夹中的类如下: 2. 功能:生成jpeg 格式 二维码,通过Api 来请求 在 IQRCodeService 中添加定义的方法,返回的类型为Bitmap,引用Stytem.Drawing using System.Drawing; namespace QRCode.Api.Services.Interfaces { public interface IQRCodeService {   Bitmap GetQRCode(string url, int pixel); } } 在QRCodeService 中继承 IQRCodeService接口,实现 GetQRCode 方法。 using QRCode.Api.Services.Interfaces; using QRCoder; using System.Drawing; namespace QRCode

iPhone Objective C: How to get a pixel's color of the touched point on an UIImageView?

陌路散爱 提交于 2019-11-27 15:17:04
iPhone Objective C: How to get a pixel's color of the touched point on an UIImageView , even if the parent UIView or itself is being rotated by the CGAffineTransformMakeRotation function? Will the view property of the UITouch still correctly return the correct pixel of the touched point even if the UIView / UIImageView is being scaled and rotated? Many thanks for reading edited: Thanks for the answer & comments, but sorry I still don't know how to get the X,Y point of the scaled/rotated image from the touch event, and then extract the color from it. Would anyone mind to help? Dave DeLong A

Pixel to MM equation?

北慕城南 提交于 2019-11-27 14:45:55
Is there a reliable equation to work out pixel size to MM? Or is that not possible cross device? We are working with a bespoke system that delivers content to many devices with different screen sizes, it can detect the screen width in MM, but we would like to accurately convert this to pixel size to deliver correctly sized images dynamically using a simple jquery script!? Any ideas? Cheers Paul What i did : <div id="my_mm" style="height:100mm;display:none"></div> Then: var pxTomm = function(px){ return Math.floor(px/($('#my_mm').height()/100)); //JQuery returns sizes in PX }; tl;dr: If you don

How do I read pixels from a PNG file?

随声附和 提交于 2019-11-27 14:27:00
I know how to capture a screenshot by using Robot, Windowtester or FEST. I also know how to read a pixel from the screen by using robot. int x = 10; int y = 10; Color px = getPixelColor(int x, int y); However, I don't know how to read a pixel from an image that is already captured. I'm planning to compare a current image, with an image from file. Lets say both are PNG. Are there any frameworks that I can use to compare images pixel by pixel? hughes Is this in Java? If so, you can use ImageIO.read( "yourImage.png" ) to get a BufferedImage . That will have a getData() method which will give you