Bad image quality after resizing/scaling bitmap

Use createScaledBitmap will make your image looks very bad. I’ve met this problem and I’ve resolved it. Below code will fix the problem: public Bitmap BITMAP_RESIZER(Bitmap bitmap,int newWidth,int newHeight) { Bitmap scaledBitmap = Bitmap.createBitmap(newWidth, newHeight, Config.ARGB_8888); float ratioX = newWidth / (float) bitmap.getWidth(); float ratioY = newHeight / (float) bitmap.getHeight(); float middleX = newWidth / … Read more

Getting image dimensions without reading the entire file

Your best bet as always is to find a well tested library. However, you said that is difficult, so here is some dodgy largely untested code that should work for a fair number of cases: using System; using System.Collections.Generic; using System.Drawing; using System.IO; using System.Linq; namespace ImageDimensions { public static class ImageHelper { const string … Read more

High Quality Image Scaling Library [closed]

Here’s a nicely commented Image Manipulation helper class that you can look at and use. I wrote it as an example of how to perform certain image manipulation tasks in C#. You’ll be interested in the ResizeImage function that takes a System.Drawing.Image, the width and the height as the arguments. using System; using System.Collections.Generic; using … Read more

Get average color of image via Javascript

AFAIK, the only way to do this is with <canvas/>… DEMO V2: http://jsfiddle.net/xLF38/818/ Note, this will only work with images on the same domain and in browsers that support HTML5 canvas: function getAverageRGB(imgEl) { var blockSize = 5, // only visit every 5 pixels defaultRGB = {r:0,g:0,b:0}, // for non-supporting envs canvas = document.createElement(‘canvas’), context … Read more