Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't paste two images from clipboard in markdown cell #3182

Closed
ghost opened this issue Jan 5, 2018 · 9 comments
Closed

Can't paste two images from clipboard in markdown cell #3182

ghost opened this issue Jan 5, 2018 · 9 comments

Comments

@ghost
Copy link

ghost commented Jan 5, 2018

Hi, I recently discovered the awesome paste image feature from clipboard in a markdown cell. However, as images are inserted as markdown code ![image.png](attachment:image.png), when inserting two images in the same cell, the first image is replaced by the second one and the first one is overwritten.

@telamonian
Copy link
Contributor

Found this issue after having the exact same problem. I think the overwrite occurs due to every pasted image having the same name (ie image.png) in the notebook's metadata.

Does anyone know if there's a way to rename the inline image immediately after pasting?

@telamonian
Copy link
Contributor

One easy fix would be for the notebook to automatically name each image sequentially: image00.png, image01.png, etc. I bet they didn't implement it that way in order to prevent images from becoming orphaned amongst the cell metadata over the course of multiple cycles of copy-paste. If the user had to manually set extra names, though, they would at least be aware of which images were being preserved.

ihnorton added a commit to ihnorton/notebook that referenced this issue Aug 3, 2018
…le image paste per cell

WIP because it needs to GC the attachments???
ihnorton added a commit to ihnorton/notebook that referenced this issue Aug 3, 2018
@ihnorton
Copy link

ihnorton commented Aug 3, 2018

Proposed fix: #3821, use a uuid for each attachment.

A more sophisticated thing would be to hash the image content to avoid storing duplicate attachments if an image is pasted twice (at least in the same cell). I didn't see a hashing library dependency already, so I didn't do that.

prevent images from becoming orphaned amongst the cell metadata over the course of multiple cycles of copy-paste.

I was worried about this too, but found per #621, attachments will be scrubbed automatically when the notebook is saved.

@zimmermant
Copy link

This still seems to be a problem. Anyone have a fix for this?

@nlahri
Copy link

nlahri commented Sep 4, 2019

I am also looking for a solution to the same problem.

1 similar comment
@cyapur
Copy link

cyapur commented Mar 23, 2020

I am also looking for a solution to the same problem.

@evyasonov
Copy link

Same problem. Please fix

@0xRampey
Copy link

0xRampey commented Jun 1, 2020

This issue is still relevant now 2 years since it was opened. A fix would be greatly appreciated.

@withrocks withrocks mentioned this issue Jul 10, 2020
@DanielGoldfarb
Copy link

DanielGoldfarb commented Jan 26, 2021

This was working fine for me yesterday. As I pasted each image in the same cell, and number was automatically attached to the name of the image: image.png, image-1.png, image-2.png, etc.

Now today it seems to be behaving as described above. I have not changed anything. Any ideas? Is there some configuration on my machine that could have changed?


As a workaround, I had to drag the two images into two different markdown cells, and then (after saving the notebook and shutting down the notebook server) I used a text editor to move one of the "attachments": {"image-name.png: { "image/png" : ...} sections from the attachements section of one cell to the attachements section of the other cell.


Some more information:
It appears the difference between when this worked for me, and when it didn't appears to be this:

  • It worked when I did "copy image" and "paste" into the notebook cell; that is, I could copy/paste more than one image into the same cell -- but see exception below:
  • Exception: Whether the paste works, seems to depend on from which app the image was copied. If copied from Fastone Image Viewer, it consistently works fine. If copied from Chrome, sometimes it works and sometimes not. If copied from Windows Photos, it does not work at all.
  • However drag-and-drop (vs. copy/paste) of an image file consitently works for the first file, but does not allow multiple image attachments to be added to one cell.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants