MathGroup Archive 2009

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

Search the Archive

Re: Precise bitmaps

  • To: mathgroup at
  • Subject: [mg96723] Re: Precise bitmaps
  • From: lehin.p at
  • Date: Sun, 22 Feb 2009 03:12:28 -0500 (EST)
  • References: <gnq6ni$83g$>

On 22 =C6=C5=D7, 03:37, "Diamond, Mark" <d... at> wrote:
> A question was asked back in 2005 about precise bitmaps. I have a similar
> question with regard to Mathematica version 7.
> Looking at the new image-manipulation functions in V7, I expected this to=
> quick ... I'd like to be able to create a series of stimuli for use in an
> experiment. The first step in creating the stimuli is to create a 512 x 5=
> greyscale image with a white background and which contains the drawn
> objects.
> I tried the following to create a JPEG image with dimensions 128x128 ...
> circ=Graphics[Circle[{0,0},62]]
> rasterCirc=Rasterize[circ,RasterSize->{128,128}]
> Export["circle.jpg",rasterCirc]
> but instead the image dimensions are 360 x 363 pixels. I had also hoped t=
> I could obtain an antialiased arc but the only antialiasing option seems =
> be for Style, which then produces a non-Graphics object.
> Can anyone see a simple (i.e., not very low-level programming) solution t=
> the problem within Mathematica? What have I missed conceptually that woul=
> explain the 360x363 pixel dimensions instead of my expected 128x128? And =
> there a way to obtain the anti-aliased circle?
> Cheers,
> Mark Diamond

The solution for your problem is:

circ = Graphics[Style[Circle[{0, 0}, 62], Antialiasing -> True],
  ImageSize -> {128, 128}]
Export["circle.jpg", circ, "Smoothing" -> 0,
 "CompressionLevel" -> 0]

The default "Automatic" value of the option ImageSize results in
producing raster graphics with 360 pixels width. This is undocumented
behavior and I do not know how to change it:

  • Prev by Date: Re: Precise bitmaps
  • Next by Date: Re: Mathematica question about commutativity of multiplication
  • Previous by thread: Re: Precise bitmaps
  • Next by thread: Re: Precise bitmaps