Cropping Picture from Clipboard

There’s something I’m missing.

I’m using screencapture to capture a window on my Mac to the clipboard.
screencapture -icwd ’ works fine

I then want to crop and display image.

I try to use the dimensions on the screen to crop image, but the pixel width and height of the picture I get from the clipboard has way more pixels.

Is there a simple way to do this? e.g. some ratio? or do I have to use some type of edge detection algorithm to crop the clipboard image and then display? And by the way if anyone has an edge detection algorithm, ping me :wink:

You forget to give essential information:
a. running OS (eventually)
b. your monitor is Retina / HiDPI ?

b. will explain why you get more pixels than what you think.

But this does not matter, because you do not asked how to shrink the image resolution, but the image size…

  1. Create a new Picture using the Clipboard width, height
    Do not forget to set the horizontal and vertical depth to the one you will find in Clipboard.

  2. Then Draw the Clipboard picture to your Offscreen Picture at the size you want (width, height)…

https://documentation.xojo.com/api/user_interface/clipboard.html#clipboard

https://documentation.xojo.com/api/graphics/graphics.html#graphics-drawpicture

Why don’t you simply take the dimensions of the returned picture instead?