MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Image[], Graphics[Raster[]]

  • To: mathgroup at
  • Subject: [mg100420] Re: Image[], Graphics[Raster[]]
  • From: lehin.p at
  • Date: Wed, 3 Jun 2009 01:10:27 -0400 (EDT)
  • References: <6147782.1243412890107.JavaMail.root@n11> <>

On 2 =C9=C0=CE, 14:46, Jens-Peer Kuska <ku... at>
> Hi,
> what do you want ? a solution to the problem or
> a pointer to the documentation ?

First of all I would want to get a pointer to documentation where such
functions as "Image`ToGraphicsRaster" and "Image`PossibleImageQ" are
documented. Are there other such built-in functions? At this moment I
even can't imagine from where I could learn that such functions

And recently I had an opposite problem: how to convert Graphics[]
(that contain Raster[]) to Image without loosing quality. Why I need
this? There are two reasons:

1) Graphics has a default width 360 pixels and in this way the quality
will be only 360 pixels width even if Raster[] inside Graphics[]
contains much more points. And resizing does not help. It also
directly affects Export[]... :( But Image[] always has true dimensions
and preserves quality. I discussed it in detail here:

2) I have not found a perfect way how to change *default* width of
Graphics[] (without using ImageSize). I discussed it here:

I have created a function Raster2Image that converts Graphics[Raster
[]] to Image with preserving quality (as opposed to Image[Graphics]):

Raster2Image = Image[Part[#, Sequence @@ Position[#, _Raster]
[[1]], 1], ColorSpace -> "RGB"] &;

But it is not so universal as I would want. May be there is an built-
in alternative to this? Or you have more universal variant?

I also created function fix4Graphics that fixes the above-mentioned
behavior (loosing quality):

fix4Graphics = Append[#, ImageSize -> Reverse[Take[Dimensions
[Part[#, Sequence @@ Position[#, _Raster][[1]], 1]], 2]]] &;

But it is also faraway from universality.

So I am interested in more universal solutions and knowledge about
undocumented functions for working with graphics...

  • Prev by Date: Re: Compositing, 3D graphics, and KDE 4.2
  • Next by Date: Re: RandomReal gets stuck
  • Previous by thread: Re: Image[], Graphics[Raster[]]
  • Next by thread: Re: Reading Fortran Data file