Hi all,

REALbasic 2007r2 Pro for Mac OS X
Mac OS X 10.4.9

PhotoShop (long time ago) allowed me to display an image using "Points" or 
"Pixels".

When the image resolution is 72 dpi (Macintosh - historical - default 
resolution), the result was the same (the same image size). But when the image 
resolution is - say - 300 dpi, in one case (Points), the image display was 
"small" and the other case (Pixels - think "Display all pixels") is larger 
(both taller and wider) than the other case. This is the REALbasic standard 
behavior.

Using Preview, the default is "display the image as large as the window / 
monitor screen allows". But Command-Option-0 display the "true resolution" 
(what that old PhotoShop displays as Points). [The menu item name is probably 
"Real size").

To be perfectly clear (I hope so), one display mode shows n pixels per Point, 
and in the other display mode, every Pixel is displayed (and if the resolution 
is higher than the default value, the image can be far greater than the window 
screen width and height.

My question is simple:

How can I display the image in the other way (display the image Points instead 
of the image Pixels) ?

TIA,

Emile

BTW: in the debugger, a Double is displayed as: "300," (for a 300 dpi value). 
And in the OffScreenPict list of properties, the HorizontalResolution and 
VerticalResolution values are represented as Integer (the LR states these 
values are of type Integer, but some other software I can use sometimes gives 
that values as Double...).

PS: I checked in the debugger the OffScreenPict Picture resolutions (V and H) 
are 300 dpi. The displayed image takes nearly all the screen width (image 
width: 1,200; Monitor width: 1,280): I display every pixels of the image.

For your info, here is the code used to load the image (I pass the dropped 
FolderItem to the method in Canvas1.DropObject):

Sub DisplayImage(GraphicFI As FolderItem)
  // Global:  OffScreenPict As Picture
  Dim tmpPict       As Picture
  Dim grWidth       As Integer
  Dim grHeight      As Integer
  Dim grWidthRes    As Integer
  Dim grHeightRes   As Integer
  
  // Load the image in the tmpPict Picture
  tmpPict = GraphicFI.OpenAsPicture
  
  If tmpPict = Nil Then
    MsgBox "DisplayImage" + EndOfLine + EndOfLine + "tmpPict is Nil"
    Return
  End If
  
  // Get some Picture properties
  grWidth     = tmpPict.Width
  grHeight    = tmpPict.Height
  grWidthRes  = tmpPict.HorizontalResolution
  grHeightRes = tmpPict.VerticalResolution
  
  // Clears the useless object
  tmpPict = Nil
  
  // Now create the Picture
  OffScreenPict = NewPicture(grWidth,grHeight,32)
  If OffScreenPict = Nil Then
    MsgBox "DisplayImage" + EndOfLine + EndOfLine + "OffScreenPict is Nil"
    Return
  End If
  
  // With or without the two following lines produce the same result
  OffScreenPict.HorizontalResolution = grWidthRes
  OffScreenPict.VerticalResolution   = grHeightRes
  
  // Draw the image in the Picture
  OffScreenPict = GraphicFI.OpenAsPicture
  
  // Assign the Picture to the canvas
  cGraphic.Backdrop = OffScreenPict
  
  // and refresh the canvas contents
  cGraphic.Refresh

End Sub


The image used for the test specs are (from Preview):

Document type:  JPEG Image
Image Size:     1200 x 730 (Width, Height)
DPI:            300
Color space:    Grey
No ColorSync profile

Depth:  8 bits
The used software is Adobe Photoshop CD Windows (the image is a scan I get from 
the Internet). It have Exif, JFIF and TIFF properties...



Late breaking news:
-------------------
When I set the OffScreenPict VertricalResolution’ and HorizontalResolution’ to 
300, the Picture resolution are set to 300; otherwise they are set - per 
default as stated by the LR - to 72 dpi. AND the Width and Height values does 
not change.

Resizing the image (using Width / 72 and Height / 72 in the extended 
parameters) does not give the same result Preview gave me!

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to