the mysterious skull painting (code)

Share your advanced PureBasic knowledge/code with the community.
applePi
Addict
Addict
Posts: 1404
Joined: Sun Jun 25, 2006 7:28 pm

the mysterious skull painting (code)

Post by applePi »

it is called The Ambassadors:
http://en.wikipedia.org/wiki/The_Ambassadors_(Holbein)
Image
look at the bottom there are something like a plate, but it is a tilted 2D skull with regard to the viewer outside, and if you enter the Ambassador room you can look at the object and see this 2D skull.
i am sure the tilted or rotated objects are related to the matrix math like the OpenGL math. but i find it easier to imagine it as a compressed object (wich may be also have relations to matrices?!!!).
so we can resize the skull image vertically by 5 to see it semi normally.
attached the skull picture before resizing (after rotating it) :
Image
and after resizing:
Image
i have used the image.pb from the pb examples folder to display and resize vertically the image

Code: Select all

UseJPEGImageDecoder()
UseJPEGImageEncoder()

If OpenWindow(0, 0, 0, 640, 480, "Image Resize")

  If CreateImage(0, 416, 304)
    StartDrawing(ImageOutput(0))
    file$= "skull.jpg" 
    LoadImage(0, file$)
    StopDrawing()
  EndIf
  ResizeImage(0, 416, 304)
  CopyImage(0, 1)
  ResizeImage(1, 100, 500)
  
  Repeat
    EventID = WaitWindowEvent()
    If EventID = #PB_Event_Repaint
      StartDrawing(WindowOutput(0))
        DrawImage(ImageID(0), 20, 10)
        DrawImage(ImageID(1), 440, 0)
      StopDrawing()    
    EndIf
  Until EventID = #PB_Event_CloseWindow
  
EndIf

End
akj
Enthusiast
Enthusiast
Posts: 668
Joined: Mon Jun 09, 2003 10:08 pm
Location: Nottingham

Re: the mysterious skull painting (code)

Post by akj »

I have been experimenting with applePi's program but had a problem as it kept crashing. Below is a extract from my code, just sufficient to show the problem.

Code: Select all

EnableExplicit

Enumeration
  #imgAmbassadors
  #imgClipped
EndEnumeration

Define wclip, hclip

UseJPEGImageDecoder()
LoadImage(#imgAmbassadors, "skull.jpg")
wclip = 330: hclip = wclip/2
GrabImage(#imgAmbassadors, #imgClipped, 112, ImageHeight(#imgAmbassadors)-hclip, wclip, hclip)
StartDrawing(ImageID(#imgClipped))
StopDrawing()
Every time I run this code (with debugger on) it crashes on the StartDrawing() line with the error message "Invalid memory access (read error at address ...)"
I am using Windows 7 and PureBasic 4.61 final. Is this a Windows bug or am I doing something wrong?
Anthony Jordan
MachineCode
Addict
Addict
Posts: 1482
Joined: Tue Feb 22, 2011 1:16 pm

Re: the mysterious skull painting (code)

Post by MachineCode »

Looking at the painting, is that skull supposed to be hidden or subliminal or something? Because it's so damn obvious what it is, and how out of place it looks. I knew it was a squashed skull even before I read your text, and thought it was something you had just pasted onto the image.

I guess people back then were more easily fooled. :lol:
Microsoft Visual Basic only lasted 7 short years: 1991 to 1998.
PureBasic: Born in 1998 and still going strong to this very day!
User avatar
idle
Always Here
Always Here
Posts: 5915
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: the mysterious skull painting (code)

Post by idle »

as a guess
Result = GrabImage(#Image1, #Image2, x, y, Width, Height)

Code: Select all

EnableExplicit

Enumeration
  #imgAmbassadors
  #imgClipped
EndEnumeration

Define wclip, hclip

UseJPEGImageDecoder()
LoadImage(#imgAmbassadors, "skull.jpg")
wclip = 330: hclip = wclip/2
result = GrabImage(#imgAmbassadors, #imgClipped, 112, ImageHeight(#imgAmbassadors)-hclip, wclip, hclip)
StartDrawing(ImageID(result))
StopDrawing()
Windows 11, Manjaro, Raspberry Pi OS
Image
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Re: the mysterious skull painting (code)

Post by Foz »

MachineCode wrote:Looking at the painting, is that skull supposed to be hidden or subliminal or something?
It appears that it was for people who just walk into the room with the people at a very tight angle to the painting, and they would see a normal shaped skull and freak out, until they tried to get a better look at the painting.

Some people call it a mystery.

I call it taking advantage of optical illusions to promote the image further, and get people to look closely at it.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8451
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Re: the mysterious skull painting (code)

Post by netmaestro »

As the Wikipedia article reports, one popular view is that the painting was made to be hung in a stairwell, where people climbing the steps with the painting just to their left would be startled by a perfect 3D skull staring at them. Seems as likely an explanation as any. Pretty cool stuff for 1533 though!

@Akj: Should be StartDrawing(Imageoutput( instead of StartDrawing(ImageID(
BERESHEIT
Post Reply