Upload images to Imgur from Mathematica

A little bird just informed me of a Mathematica solution to this question (the underlying implementation still uses JLink, but this answer hides all the java related code): imgur[expr_] := Module[ {url, key, image, data, xml, imgurUrl}, url = “http://api.imgur.com/2/upload”; key = “c07bc3fb59ef878d5e23a0c4972fbb29”; image = Fold[ExportString, expr, {“PNG”, “Base64”}]; xml = Import[url, “XML”, “RequestMethod” -> …

Read more

Integrating notebooks to Mathematica’s documentation center

To show how to create documentation that incorporates to the Documentation Center we will create a package that contains very simple functions and its documentation. Lets call our package SOPackage. This package will be stored in a folder of the same name and such folder should be stored in either $BaseDirectory or $UserBaseDirectory$. The SOPakage …

Read more

Remove White Background from an Image and Make It Transparent

This function implements the reverse blend described by Mark Ransom, for an additional small but visible improvement: reverseBlend[img_Image, alpha_Image, bgcolor_] := With[ {c = ImageData[img], a = ImageData[alpha] + 0.0001, (* this is to minimize ComplexInfinitys and considerably improve performance *) bc = bgcolor}, ImageClip@ Image[Quiet[(c – bc (1 – a))/a, {Power::infy, Infinity::indet}] /. {ComplexInfinity …

Read more