How can I rasterize a Cell by CellExpression

How can I convert a Cell Rasterized Cell

cellExpression1=Cell[BoxData["test"],"Input"];CellPrint@cellExpression1


The corresponding cell of cellExpression2 is obtained by Menu>Cell>ConvertTo>Bitmap

cellExpression2=Cell[BoxData[GraphicsBox[TagBox[RasterBox[CompressedData["1:eJztmLFuwjAQhqO2Q1+jO+IB2NpHoGLrAlKzVqKVKsRL8AK8BitDd1YGFthZmdukKWlsn+07xyEo+j8ZFIS53P9ffHF4mLwN05skSd7vs7fh+PNxOh3Pnu+yD0+zj9fJbXbQz14v2Ss//gYAAAAAAAB0l91yk/S+kt5msW87lRjEkHNM8wi/Y36MmFtLxJCzPwzKIKPDLmp+LRBFDjxpKMj1AE9Masg5N2f28Par9TbkVw5F/2O7yr8rmmdx3IAc+tTuYb21MfKhhSiQllJjsDw1IieaJ5UbX4AWgauXKLH0YqMUCQwpRrqmHJEqotZjDDmWlCRNaTX3Om+aRiwiTQ7hm2paQ3IiBGHnqUk2ZyoTrD25tNfXmtrzhCeEmmyewrJ26IXmpTVPTouRtKfVbm7M23pXPNHTCO6NgXKiBGnAE3bwq+2x1ZuOv3a1UReXs81e0JM/E8oJ6rYzsB9WI/uCVKvgmhkmxxGEKLp+JZ8nmFe4bVGoM7VWqbUROkn9XFxPBHI8Z2R3OfE+lrAuZFvu3qIEy1FhP3/pdayvSB7Bv06D5ahwdgiWZER1MUos84TxfF1Xjo7xCCP4rSMNVvMsSmYrcdC/zXXkAAAAAAAAAEAH+AHwj0Np"],{{0,46},{92,0}},{0,255},ColorFunction->RGBColor],BoxFormImageTag["Byte",ColorSpace->"RGB",Interleaving->True],Selectable->False],BaseStyle->"ImageGraphics",ImageSize->Automatic,ImageSizeRaw->{92,46},PlotRange->{{0,92},{0,46}}]],"Input"];CellPrint@cellExpression2


So my question is a function

RasterizeCellExpression[cellExpression1]


which will yield cellExpression2

-
I had to do things like this when I wrote the original (now defunct) version of the image uploader, and if you strive for perfection, it can get very hairy. The simplest way is Rasterize@CreateDocument[cellExpression1]`. Start with this, and let me know if you bump into problems. I might be able to give tips on how to work around them, but there may be compromises. Ideally, you'll want to create a hidden document (Visible -> False) and close it when you're done with the rasterization. –  Szabolcs Sep 30 at 19:15