Possible bug w/ "clipboard:"
Posted: 2012-02-07T16:43:51-07:00
I'm trying to use ImageMagick in conjunction with VBA to create PNGs from Excel via the clipboard. If the data is copied to the clipboard normally, ImageMagick works perfectly. However, if the data is copied to the clipboard through VBA, ImageMagick fails to see any image data on the clipboard.
The VBA code in question is:which copies the contents of <rangeObject> to the clipboard as an image.
With this data, ImageMagick returns:
With the same data,
generates the image properly.
Installed version is ImageMagick-6.7.5-0-Q16-windows.zip (portable package) on Windows 7 (x64), running Excel 2010 (32-bit).
Easiest way to reproduce is by opening Excel, putting some random data in a cell, selecting said cell, and in the VBA Immediate window running:This will put the image data on the clipboard for analysis.
The VBA code in question is:
Code: Select all
Range(<rangeObject>).CopyPicture xlScreen, xlPicture
With this data, ImageMagick returns:
Code: Select all
C:\test>convert clipboard:myimage -density 150 -units pixelsperinch testpls.png
convert.exe: no bitmap on clipboard `myimage' @ error/clipboard.c/ReadCLIPBOARDImage/138.
convert.exe: missing an image filename `testpls.png' @ error/convert.c/ConvertImageCommand/3016.
Code: Select all
i_view32 /clippaste /convert=testIV.png
Installed version is ImageMagick-6.7.5-0-Q16-windows.zip (portable package) on Windows 7 (x64), running Excel 2010 (32-bit).
Easiest way to reproduce is by opening Excel, putting some random data in a cell, selecting said cell, and in the VBA Immediate window running:
Code: Select all
Selection.CopyPicture xlScreen, xlPicture