Developing a tracking pixel

You can write a script that creates and returns a .gif, .jpeg or .png image using PHP for tracking purposes using the GD library (which is often distributed with PHP in modern versions). If you don’t have access to GD, you can always recompile PHP with GD enabled. Example: pixel.php (commented for the purposes of … Read more

Fast work with Bitmaps in C#

You can do it a couple of different ways. You can use unsafe to get direct access to the data, or you can use marshaling to copy the data back and forth. The unsafe code is faster, but marshaling doesn’t require unsafe code. Here’s a performance comparison I did a while back. Here’s a complete … Read more

Pixels vs. Points in HTML/CSS

Use px or em CSS FONT-SIZE: EM VS. PX VS. PT VS. PERCENT Points (pt): Points are traditionally used in print media (anything that is to be printed on paper, etc.). One point is equal to 1/72 of an inch. Points are much like pixels, in that they are fixed-size units and cannot scale in … Read more

How to read the Color of a Screen Pixel

This is the most efficient: It grabs a pixel at the location of the cursor, and doesn’t rely on only having one monitor. using System; using System.Drawing; using System.Drawing.Imaging; using System.Runtime.InteropServices; using System.Windows.Forms; using System.Diagnostics; namespace FormTest { public partial class Form1 : Form { [DllImport(“user32.dll”)] static extern bool GetCursorPos(ref Point lpPoint); [DllImport(“gdi32.dll”, CharSet = … Read more

Android TextView setTextSize incorrectly increases text size [duplicate]

Heh, mixed units problem. Seems a little counterintuitive, but it’s an easy fix. The default method setTextSize(float) assumes you’re inputting sp units (scaled pixels), while the getTextSize() method returns an exact pixel size. You can fix this by using the alternate setTextSize(TypedValue, float), like so: this.setTextSize(TypedValue.COMPLEX_UNIT_PX, size); This will make sure you’re working with the … 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

Get Pixel color of UIImage

Try this very simple code: I used to detect a wall in my maze game (the only info that I need is the alpha channel, but I included the code to get the other colors for you): – (BOOL)isWallPixel:(UIImage *)image xCoordinate:(int)x yCoordinate:(int)y { CFDataRef pixelData = CGDataProviderCopyData(CGImageGetDataProvider(image.CGImage)); const UInt8* data = CFDataGetBytePtr(pixelData); int pixelInfo = … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)