June 19, 2023

Workaround Copy/Paste images

Sometimes copy/ pasting images from one application (specially from Microsoft) to another does not work. I share here a workaround for this issue.

Problem description

In some cases, when copying images in Office Applications, you can not paste them into other applications.
Examples: from Microsoft Word to Confluence or from Microsoft Teams to MS Paint.

See this bug report for Microsoft Teams and this improvement suggestion/feedback.

Using Greenshot

Greenshot is a highly recommended freeware.

Open image from clipboard

Right-mouse click in Greenshot System Tray Icon

Select "Open image from clipboard


Copy to Clipboard


Then you shall be able to paste the image.

Using AutoHotkey

This solution requires the Gdip Library

sClipboard := Clipboard  
sPat = ^<img src="data:image/.*base64,([^"]*)
If RegExMatch(sClipboard,sPat,sMatch) {
    If !pToken := Gdip_Startup()
        {
            MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
            return
        }
    ClipBackup := clipboardAll
    b64 := sMatch1
    pBitmap := Gdip_BitmapFromBase64(b64)
    suc := Gdip_SetBitmapToClipboard(pBitmap)
    Clip_Wait()
    Send ^v
    Clip_Restore(ClipBackup)
    return
}

This is included in the NWS PowerTool in the IntelliPaste feature.

No comments:

Post a Comment