Behavior of copy and paste with different image formats


Ok, let's say I create a 1x1 pixel image.

i = Image[{{0}}, "Byte"];

Now I Export["image.png", i] the image and import it into Libreoffice or Inkscape in Windows 7. Then I copy and paste the image back into Mathematica 8.0.1 and calculate the ImageDimensions.

ImageDimensions[x = Rasterize[<image>]]

I would expect to receive the 1x1 but instead I get {13, 17} because of appended white borders around the image.

Now If I save the copied output form LibreOffice and Inkscape and then Import the file into Mathematica, I run into no problems.

What file formats have issues with Mathematica so I can consistently paste from the clipboard? I know Mathematica has multiple ways to copy files MetaFile and Bitmap under Edit->Copy As, but how do these relate to different way to paste objects?


Posted 2013-05-28T19:23:28.487

Reputation: 7 329

Isn't your issue the clipboard? What supports your claim that the issue comes from MMA? – anderstood – 2019-05-27T14:08:06.370

@anderstood it's been a long time since I messed with this question but I believe I used clip spy – William – 2019-05-27T14:19:30.197

Perhaps Rasterize is doing some blurred edges for you? – cormullion – 2013-05-28T19:41:52.790

1On a Mac, copying from the Front End produces an image on the clipboard that depends on the display size in the notebook; you also get artifacts at pixel boundaries. Try Export to a file, and insert the file. – Michael E2 – 2013-05-28T21:35:56.220

1@MichaelE2 I wish Exporting the image to a file solved the issue, but I am trying to bring images into Mathematica. Mathematica has issues with importing certain types of image formats from clipboard. I am trying to determine what file types in the clipboard cause mathematica problems. Ultimately there are some applications that I use on a regular that don't an export to file option, but can't work around the issue without diagnosing the issue first. – William – 2013-05-28T22:08:06.563

Being on a Mac, I'm limited in my ability to help. All I could contribute is that in the process described, going Mma -> App -> Mma, the image seems to be modified in the first step. (In the second step, pasting into Mma, I'm using different apps, and I'm not sure that is relevant to your case.) Anyway, I hope someone else can help you. – Michael E2 – 2013-05-28T22:13:49.063

No answers