Automatic Retina images for web sites

There is a new attribute for the img tag that allows you to add a retina src attribute, namely srcset. No javascript or CSS needed, no double loading of images. <img src=”https://stackoverflow.com/questions/13744542/low-res.jpg” srcset=”https://stackoverflow.com/high-res.jpg 2x”> Browser Support: http://caniuse.com/#search=srcset Other Resources: WebKit release post W3C documentation for srcset good explanation about why and how to use srcset … Read more

Image Segmentation using Mean Shift explained

The basics first: The Mean Shift segmentation is a local homogenization technique that is very useful for damping shading or tonality differences in localized objects. An example is better than many words: Action:replaces each pixel with the mean of the pixels in a range-r neighborhood and whose value is within a distance d. The Mean … 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

SVG rounded corner

Here is how you can create a rounded rectangle with SVG Path: <path d=”M100,100 h200 a20,20 0 0 1 20,20 v200 a20,20 0 0 1 -20,20 h-200 a20,20 0 0 1 -20,-20 v-200 a20,20 0 0 1 20,-20 z” /> Explanation m100,100: move to point(100,100) h200: draw a 200px horizontal line from where we are … Read more

How to put an image in div with CSS?

This answer by Jaap : <div class=”image”></div>​ and in CSS : div.image::before { content:url(http://placehold.it/350×150); }​ you can try it on this link : http://jsfiddle.net/XAh2d/ this is a link about css content http://css-tricks.com/css-content/ This has been tested on Chrome, firefox and Safari. (I’m on a mac, so if someone has the result on IE, tell me … Read more

Convert PIL Image to byte array?

Thanks everyone for your help. Finally got it resolved!! import io img = Image.open(fh, mode=”r”) roi_img = img.crop(box) img_byte_arr = io.BytesIO() roi_img.save(img_byte_arr, format=”PNG”) img_byte_arr = img_byte_arr.getvalue() With this i don’t have to save the cropped image in my hard disc and I’m able to retrieve the byte array from a PIL cropped image.

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