[Date Index] [Thread Index] [Author Index]
Re: 2 questions about bitmap images
Hi, 1) since you have no alpha channel there is no way to make a pixel transparent. My PNG import function habdles alpha-channels by creating two new color functions GrayAlpha and RGBAlphaColor with an optional background color, that is blended with the colors. Since Mathematica's graphics base on PostScript you don't have a alpha channel in the PostScript display but you may use a very different background color to mark the transparent parts of the picture. Since Mathematica's own Export/Import functions ignore an alpha channel (The PNG Import/Export package handles it correct.) you can't save your alpha channel with the build in functions. It's not a good idea to make black frames arround transparent pixels because it will add many additional graphics data with points and will dramatical increase the memory for the image. For resonable image resolutions the black frame become to small and your transparent pixel is shown as black. Using a fancy background color keep the compact character of PostScript's imagedata and is visible for smaller pixels 2) I have never used the Digital Image Processing toolkit but ImportString[ExportString[graphics,"PBM"],"PBM"] will return a Graphics[Raster] object with the bitmap and the toolkit should have some conversion functions to make a ImageData out of it. Regards Jens "Barthelet, Luc" wrote: > > 1) I would like to use Raster to display a bitmap in a graphic, but I would > like some of the values of the bitmap to not be displayed (100% transparent > pixels). > I have been able to achieve this by writing my own version of Raster that > draw each pixel as a rectangle, but I would like to know if there is a way > to get the regular Raster to do it. I hate to carry around my own version of > Mathematica functions. > > 2) I am starting to use the "Digital Image Processing" application add-on. > Has anyone figured out how to take a graphic generated by a previous Show > command and turn it into an "ImageData" structure? It seems there should be > a way to do it using the usual Display or maybe even Export? > I'd rather not have to write a file and then read it back. > > Thanks, > > Luc > > "Things well understood are explained well!"