OpenAsPicture - anti-aliasing??? 
Author Message
 OpenAsPicture - anti-aliasing???

I am SO confused!

I am trying to open a TIFF and look at the colors of the individual
pixels. I am using a TIFF because my understanding is that a TIFF is
non-lossy. In other words, what I store in the TIFF should be EXACTLY
what I get back out. But I can't make it work!

Using PhotoShop, I have created a TIFF file that is a 10x10 pixel square
of solid RGB(3,3,3). When I open it in my RB program, it seems to come
out being a whole lot of RGB(0,0,0) pixels with a few RGB(8,8,8) pixels
mixed in, as if some sort of anti-aliasing were going on.

When I open the TIFF in other graphics programs like PhotoShop or
GraphicConverter, it still comes out solid RGB(3,3,3). So I'm pretty
sure there's no problem with my file.

If I drag it and drop the TIFF on SimpleText (and open it "with
QuickTime translation"), SimpleText also displays it as solid
RGB(3,3,3)! From this, I assume that RB isn't using QuickTime to
translate the file?

So what's going on here? Is there any way I can get my program to
identify the EXACT colors in my TIFF? (This is a statistical program for
testing digital cameras, so "close" won't cut it.)

Here's some sample code:

-------------------------

Sub Open() // working version

// this works with no problem - note that I'm creating a square
// inside my program using DrawPicture:

  dim p as Picture
  dim thisPixel as Color

  p=newPicture(10,10,32)

  p.graphics.foreColor = rgb(3,3,3)
  p.graphics.fillrect 0,0,10,10

  thisPixel = p.RGBSurface.Pixel(5,5)

  // the following should all be on one line
  msgbox "RGB = "+str(thisPixel.red)+", "+str(thisPixel.green)+",
"+str(thisPixel.blue)

  // the program displays: "RGB = 3,3,3"

End Sub

-------------------------

Sub Open() // non-working version (open from file)

// Here I am trying to do exactly the same thing, except from a
// file -- this DOESN'T WORK!

  dim temp,p as Picture
  dim thisPixel as Color
  dim f as FolderItem

  f=GetFolderItem("333.tif")
  if f = nil then
    msgBox "Can't find 333.tif - quiting"
    quit
  end if

  temp = f.openAsPicture

  p=newPicture(10,10,32)
  p.graphics.drawPicture temp,0,0

  thisPixel = p.RGBSurface.Pixel(5,5)

  // the following should all be on one line
  msgbox "RGB = "+str(thisPixel.red)+", "+str(thisPixel.green)+",
"+str(thisPixel.blue)

  // the program displays: "RGB = 8,8,8"

  thisPixel = p.RGBSurface.Pixel(5,6)

  // the next line should all be on one line
  msgbox "RGB = "+str(thisPixel.red)+", "+str(thisPixel.green)+",
"+str(thisPixel.blue)

  // now the program displays: "RGB = "0,0,0"

End Sub

--------------------------



Tue, 04 May 2004 10:14:58 GMT  
 OpenAsPicture - anti-aliasing???


Quote:
> // this works with no problem - note that I'm creating a square
> // inside my program using DrawPicture:

                             ^^^^^^^^^^^

I meant "fillRect" of course!

Thanks,

Chip



Tue, 04 May 2004 10:18:41 GMT  
 OpenAsPicture - anti-aliasing???

Quote:

> If I drag it and drop the TIFF on SimpleText (and open it "with
> QuickTime translation"), SimpleText also displays it as solid
> RGB(3,3,3)! From this, I assume that RB isn't using QuickTime to
> translate the file?

No, RB certainly is using QuickTime; it doesn't have any TIFF-reading
code of its own (TIFF is a rather complex format to read).  Your code
looks correct to me.  Please send me your sample file and project
privately, and I'll see if I can spot what's going on.

P.S. I'm very curious though how you measured how SimpleText is
displaying it -- it certainly doesn't have any facility for reporting
the RGB values of images it displays.  Probably you're measuring it
onscreen with something like deltaXY.  If so, what happens if you
display the same TIFF with RB and measure it on screen?

P.P.S. Please specify what version of MacOS you're running under, and
what version of QuickTime.

--
,------------------------------------------------------------------.
|    Joseph J. Strout         Check out the Mac Web Directory:     |

`------------------------------------------------------------------'



Tue, 04 May 2004 14:12:04 GMT  
 OpenAsPicture - anti-aliasing???


Quote:


> > If I drag it and drop the TIFF on SimpleText (and open it "with
> > QuickTime translation"), SimpleText also displays it as solid
> > RGB(3,3,3)! From this, I assume that RB isn't using QuickTime to
> > translate the file?

> No, RB certainly is using QuickTime; it doesn't have any TIFF-reading
> code of its own (TIFF is a rather complex format to read).  Your code
> looks correct to me.  Please send me your sample file and project
> privately, and I'll see if I can spot what's going on.

> P.S. I'm very curious though how you measured how SimpleText is
> displaying it -- it certainly doesn't have any facility for reporting
> the RGB values of images it displays.  Probably you're measuring it
> onscreen with something like deltaXY.  If so, what happens if you
> display the same TIFF with RB and measure it on screen?

> P.P.S. Please specify what version of MacOS you're running under, and
> what version of QuickTime.

Thanks, Joe - it's "in the mail!"

Chip



Tue, 04 May 2004 20:43:41 GMT  
 OpenAsPicture - anti-aliasing???
[[ This message was both posted and mailed: see
   the "To," "Cc," and "Newsgroups" headers for details. ]]

OK, here's the story.  In RB 3.5 and earlier, pictures loaded via
QuickTime are always loaded in a 16-bit depth.  QT dithers 32-bit
pictures to convert to 16-bit color.

But this has been fixed in 4.0, where not only are pictures loaded at
their true depth, but there's also a Picture.depth property which will
tell you what that depth is.

So if you need to load 32-bit pictures not in PICT format, I suggest
you download the 4.0 developer releases and give them a try.

Cheers,
- Joe

--
,------------------------------------------------------------------.
|    Joseph J. Strout         Check out the Mac Web Directory:     |

`------------------------------------------------------------------'



Wed, 05 May 2004 00:16:35 GMT  
 OpenAsPicture - anti-aliasing???


Quote:
> [[ This message was both posted and mailed: see
>    the "To," "Cc," and "Newsgroups" headers for details. ]]

> OK, here's the story.  In RB 3.5 and earlier, pictures loaded via
> QuickTime are always loaded in a 16-bit depth.  QT dithers 32-bit
> pictures to convert to 16-bit color.

Ah - I had a feeling it was something like that. (I can't tell you how
relieved I am to discover that the problem wasn't some idiotic thing _I_
was doing wrong! I finally got something RIGHT!)

:-)

Quote:
> But this has been fixed in 4.0, where not only are pictures loaded at
> their true depth, but there's also a Picture.depth property which will
> tell you what that depth is.

> So if you need to load 32-bit pictures not in PICT format, I suggest
> you download the 4.0 developer releases and give them a try.

> Cheers,
> - Joe

Thanks, Joe! I'll check out 4.0 -

Chip



Wed, 05 May 2004 01:09:39 GMT  
 OpenAsPicture - anti-aliasing???


Quote:


> > [[ This message was both posted and mailed: see
> >    the "To," "Cc," and "Newsgroups" headers for details. ]]

> > OK, here's the story.  In RB 3.5 and earlier, pictures loaded via
> > QuickTime are always loaded in a 16-bit depth.  QT dithers 32-bit
> > pictures to convert to 16-bit color.

> Ah - I had a feeling it was something like that. (I can't tell you how
> relieved I am to discover that the problem wasn't some idiotic thing _I_
> was doing wrong! I finally got something RIGHT!)

> :-)

> > But this has been fixed in 4.0, where not only are pictures loaded at
> > their true depth, but there's also a Picture.depth property which will
> > tell you what that depth is.

> > So if you need to load 32-bit pictures not in PICT format, I suggest
> > you download the 4.0 developer releases and give them a try.

> > Cheers,
> > - Joe

> Thanks, Joe! I'll check out 4.0 -

> Chip

Downloaded RB 4a5 Classic PPC, and it works great! No more problems -
thanks again, Joe!

Chip



Wed, 05 May 2004 01:47:07 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Anti-aliasing

2. Non Anti-Aliasing EditFields?

3. VRML viewer/ engine with anti-aliasing??

4. edge anti aliasing in vrml ?

5. Anti-aliasing in VRML viewer

6. Anti-Aliasing and transparency

7. Font anti-aliasing in linux tkinter or wxPython

8. Can I programmatically toggle the anti-aliasing feature of a graph?

9. J3.04: aliasing of windows with same name in different locales

10. Keyword aliasing

11. Keyword aliasing and extended-character display

12. Aliasing in Turing

 

 
Powered by phpBB® Forum Software