I will be more precise.
The original file was "test-1200.png"
I ran the script
[code]# borrowed from : How Do I Copy Image File to Clipboard and Retain Format?
use AppleScript version “2.4” – Yosemite (10.10) or later
use framework "Foundation"
use framework "AppKit"
use scripting additions
(*
set posixPath to "/Users/shane/desktop/test-1200.png"
set posixPath to POSIX path of “Macintosh HD:Users:Important:pour ebay:_X28737ƒYK:##28755.png”
*)
set posixPath to POSIX path of ((path to desktop as text) & “test-1200.png”)
set {theData, theError} to current application’s NSData’s dataWithContentsOfFile:posixPath options:0 |error|:(reference)
set theClip to current application’s NSPasteboard’s generalPasteboard()
theClip’s clearContents()
theClip’s setData:theData forType:"public.jpeg"
set theType to theClip’s (pasteboardItems()'s objectAtIndex:0)'s types() as list
set theTypes to theClip’s types() as list[/code]
I created a new mail and pasted in it.
I sent the message to myself (the joy of having several mail addresses)
I opened the received message.
I entered the small local menu listing the attachments and was proposed to save the file as “PastedGraphic-1.tiff” with its 3.8 Mbytes.
It seems that if the clipboard contain “public.png” and “public.tiff” data, Mail grabs the “public.png” component
but if the clipboard contain “public.jpeg” and “public.tiff” data, Mail grabs the “public.tiff” component.
When I pasted the same clipboard into a Pages document, as the file was a flat one I can’t see the picture file itself but looking in the file with Hexedit I found the string “PastedGraphic-1.jpeg” which is what I wished to get.
Of course, I was able to save the content of the clipboard in a jpeg file but I don’t guess what would help in doing that.
What would be fine would be the ability to remove the “public.tiff” and “NeXT TIFF v4.0 pasteboard type” components from the clipboard exactly as we may drop the style components when we copy a styled piece of text.
I will try to retrieve the script doing that to see if it may be adapted to drop the tiff components.