MathGroup Archive 2005

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

Search the Archive

Re: Show command trims bitmap edges? (newbie)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg54546] Re: [mg54351] Show command trims bitmap edges? (newbie)
  • From: Chris Chiasson <chris.chiasson at gmail.com>
  • Date: Tue, 22 Feb 2005 04:25:25 -0500 (EST)
  • References: <200502190731.CAA06017@smc.vnet.net>
  • Reply-to: Chris Chiasson <chris.chiasson at gmail.com>
  • Sender: owner-wri-mathgroup at wolfram.com

My code executes on the graphics file Matthew is working with. It
tiles a new image from two rows by three columns of the original. The
graphics file is not allowed to be posted here as MathGroup policy
states.

NotebookDirectory=
  DirectoryName[
    ToFileName["FileName"/.NotebookInformation[EvaluationNotebook[]]]];
g=Import[ToFileName[NotebookDirectory,"image001.gif"]]
Show[g]
g//FullForm
(*The image is 4 pixels wide by 7 long.*)
g[[2]]
(*The image data is seven rows by four colums.*)
g[[1,1]]//MatrixForm
g[[1,1]]//Dimensions
Needs["LinearAlgebra`MatrixManipulation`"]
TwoByThree=BlockMatrix@Table[g[[1,1]],{2},{3}]
TwoByThree//MatrixForm
Dimensions[TwoByThree]
rasterscalefactor=20;
gNew=g/.{Raster[__]\[Rule]Raster[TwoByThree],
      Rule[ImageSize,__]\[Rule]
        Rule[ImageSize,rasterscalefactor*Reverse[Dimensions[TwoByThree]]],
      Rule[PlotRange,__]\[Rule]Rule[PlotRange,All]}
gNew//FullForm
Show[gNew]

On Sat, 19 Feb 2005 02:31:52 -0500 (EST), Matthew McMahon
<matthew.mcmahon at vanderbilt.edu> wrote:
> Hello all,
> 
> I've encountered a strange issue (running 5.0) that I couldn't find any
> references to in the Help or online documentation.  I'm importing tiny
> monochrome bitmap files into Mathematica, in order to create a pattern that
> tiles the black-pixel pattern in x and y repeatedly. I can import the file
> correctly (I've checked with the Dimensions function and everything works
> properly), but when I use the Show command to check that I've got the right
> bitmap, I don't see the proper image.  I tested it by creating a
> 1-white-pixel-wide buffer around the original image, and then I saw the
> correct original image with the Show command.  So it appears that the Show
> command is somehow cropping the image by 1 pixel (for images smaller than
> 10x10 pixels).
> 
> I suppose I could just design all my bitmaps with an extra pixel buffer, but
> that's much less elegant.  Does anyone know why this is happening?
> 
> Appreciating any help,
> Matthew
> 
> 


-- 
Chris Chiasson
Kettering University
Mechanical Engineering
Graduate Student
1 810 265 3161


  • Prev by Date: Re: The two dices
  • Next by Date: Re: The two dices
  • Previous by thread: Show command trims bitmap edges? (newbie)
  • Next by thread: Re: Show command trims bitmap edges? (newbie)