Pixel-perfect Graphics, Revisited

Mathematica 7 introduces a new Image function that eliminates all the hassle previously necessary to create and export pixel-perfect raster images.

Instead of using ArrayPlot to generate the image, I can now do this:

myImage = Image[imageData, ColorSpace->RGBColor]

myImage.png

I still need to specify RGBColor to interpret the alpha channel correctly, but the option to Image is named ColorSpace, instead of the ColorFunction used by ArrayPlot.

Exporting works the same way as before:

Export["~/Desktop/myImage.png", myImage]

Except that now I can directly export a png with alpha. Much simpler overall in the new Mathematica.


Posted

in

, , ,

by

Tags: