How to convert a PIL Image into a numpy array?

You’re not saying how exactly putdata() is not behaving. I’m assuming you’re doing This is because putdata expects a sequence of tuples and you’re giving it a numpy array. This will work but it is very slow. As of PIL 1.1.6, the “proper” way to convert between images and numpy arrays is simply although the resulting array is in a different … Read more

How to vertically align an image inside a div

The only (and the best cross-browser) way as I know is to use an inline-block helper with height: 100% and vertical-align: middle on both elements. So there is a solution: http://jsfiddle.net/kizu/4RPFa/4570/ Show code snippet Or, if you don’t want to have an extra element in modern browsers and don’t mind using Internet Explorer expressions, you can use a pseudo-element and add it … Read more