Setting width/height as percentage minus pixels

You can use calc: height: calc(100% – 18px); Note that some old browsers don’t support the CSS3 calc() function, so implementing the vendor-specific versions of the function may be required: /* Firefox */ height: -moz-calc(100% – 18px); /* WebKit */ height: -webkit-calc(100% – 18px); /* Opera */ height: -o-calc(100% – 18px); /* Standard */ height: … Read more

How to Get Pixel Color in Android

You can get the pixel from the view like this: ImageView imageView = ((ImageView)v); Bitmap bitmap = ((BitmapDrawable)imageView.getDrawable()).getBitmap(); int pixel = bitmap.getPixel(x,y); Now you can get each channel with: int redValue = Color.red(pixel); int blueValue = Color.blue(pixel); int greenValue = Color.green(pixel); The Color functions return the value in each channel. So all you have to … Read more

How to check if a specific pixel of an image is transparent?

Building on Jeff’s answer, your first step would be to create a canvas representation of your PNG. The following creates an off-screen canvas that is the same width and height as your image and has the image drawn on it. var img = document.getElementById(‘my-image’); var canvas = document.createElement(‘canvas’); canvas.width = img.width; canvas.height = img.height; canvas.getContext(‘2d’).drawImage(img, … Read more

tech