New from Clipboard / Paste as New - create a new document from clipboard contents

Bug #170764 reported by Frederik Elwert on 2005-06-19
This bug affects 2 people
Affects Status Importance Assigned to Milestone

Bug Description

It would be very useful if there were possibilities to export
parts of an image as a new image. Maybe something like
the paste as new feature in GIMP, or exporting a
selection as a new svg with the width and height of the

nightrow (jb-benoit) on 2007-12-16
Changed in inkscape:
importance: Undecided → Wishlist
Ryan Lerch (ryanlerch) wrote :

Thank you for taking the time to report this feature request and helping to make Inkscape better. You requested this feature a long while ago and there hasn't been any activity in it recently. We were wondering; is this still on your wishlist? Can you try with latest Inkscape release and see if recent improvements have obsoleted your request? Thanks in advance.

Changed in inkscape:
status: New → Incomplete

This issue hasn't been obsoleted, as far as I can tell.
The desired result can of course be achieved using existing features. So when I want to create a new SVG image from a part of a drawing I could to the following:

1. Copy the part from the original drawing.
2. Open a new document.
3. Paste the object from the clipboad.
4. Open the property dialog and choose "Fit page to selection".

The feature described in this issue would allow the following:

1. Copy part from the original drawing.
2. Select "Edit → paste as new".

I don't know if other people would like this shortcut, or if it would just clutter the Edit menu further. But I think it actually is of some help when one wants to split a drawing into several pieces.

Tom Davidson (tjd-mit) on 2008-01-09
Changed in inkscape:
status: Incomplete → Confirmed
jazzynico (jazzynico) on 2010-01-13
tags: added: clipboard
removed: other
Krzysztof Kosinski (tweenk) wrote :

This should be called "New from Clipboard", if I understand what it's trying to do.

summary: - paste as new
+ New from Clipboard
summary: - New from Clipboard
+ New from Clipboard - create document from clipboard contents

I think it was titled the other way to match GIMP. In the GIMP's Edit menu is a sub-menu for Paste As which has an option for New Image. Obviously the term "Image" is not appropriate for Inkscape.

Krzysztof Kosinski (tweenk) wrote :

For Inkscape, I think "New from Clipboard" makes more sense, because we use 1 window per document, and practically nothing is shared between documents. I would expect a command from the Edit menu to do something to the current document in our setup, rather than open a new window, so I would look for such functionality there.

GIMP uses a window + several floating dialogs for tools, so it makes more sense to put this in the paste menu, because a lot of the interface is shared between documents.

summary: - New from Clipboard - create document from clipboard contents
+ New from Clipboard / Paste as New - create a new document from clipboard
+ contents
rickmastfan67 (rickmastfan67) wrote :

I know that this is something that I would like as well. Even in an older program that I still use (Paint Shop Pro 7) has this option. It would greatly help me out to have the same option in Inkscape as well.

Codain (codain) wrote :

Please find attached a working patch for this feature.

If the clipboard is empty, it does nothing and warn the user.

Please also notice that because I've used already coded subfunctions, those subfunctions add steps to the undo history. If necessary I can rewrite my patch to clear the history at the end or to get rid of them.

Thanks to the Inkscape patented developper which will test this patch (an approve it?).

Changed in inkscape:
assignee: nobody → Romain (romain2boss)
status: Confirmed → In Progress
jazzynico (jazzynico) wrote :

Looks good on Windows XP, Inkscape 11141.
Tested with some objects and images (linked and embedded).

Apparently it is restricted to the internal clipboard (copying from Paint or Gimp leaves the clipboard empty). Would it be difficult to accept objects from the system clipboard?

Codain (codain) wrote :

Thanks JazzyNico!

Yes this issue was known and this is why I've added two TODO lines in the isEmpty() function: the first patch was working but only with SVG targets (internal and external SVG clipboard).

Looking for a cleaner way of working would have mean to change a little bit the ClipboardManager architecture, so this is what I've done in the second patch (moving private _getBestTarget() to public virtual getBestTarget() ).

Now it works with SVG, bitmaps...

Please note that the clipboard is very rarely empty and that when pasting text inkscape paste nothing if no text object is selected.

A TODO item would probably be to detect this case and create a default text object but I think it's not the point here as soon as it's not the default behaviour when pasting from CTRL+V or Edit menu (in my opinion it should be a default behaviour).

jazzynico (jazzynico) wrote :

Tested again on Ubuntu 11.04, Inkscape trunk revision 11358.

Thanks for your new patch, it works better now and images from bitmaps editors are correctly taken into account.
But there are two glitches though:

1. When copying from an invalid object (a text from a text editor, or an file from a desktop icon), an empty document is created. It should be detected an treated as if the clipboard were empty (just show a specific message in the status bar).

2. Each time an object is added in the clipboard, the document count increases. Steps:
a. Open a new document with Ctrl+N.
b. The new document is labeled New document 2.
c. Create an object and copy it.
d. Open a new document with Ctrl+N.
e. The new document is labeled New document 4 (or 5 if you pressed Ctrl+C twice, and so on).

It's not as critical as a crash, but would be far cleaner if you could fix it.

ScislaC (scislac) wrote :

@Romain: Any chance you're going to look into what JazzyNico pointed out? Also, I do agree with you about the creation of a text object if one is not selected is a good TODO with it.

su_v (suv-lp) on 2012-07-04
tags: added: exporting selection
jazzynico (jazzynico) wrote :

Comment 10, point 2 is independent from the patch (reproduced with 0.47 and
New report created: Bug #1022543 'Ctrl+C increments the documents count'.

Codain (codain) wrote :

Thanks JazzyNico, I do agree with you as soon as this was what I was saying in my last comment.

At this moment developping Inkscape is quite complicated for me. I've lost contact with this project for few months because I'm a little bit angry against Bazaar & co. After spending lot of time on the Wiki page and the Bazaar website, sorry but the one in the Wiki is a little bit messy for me and seems to be not coherent (as if two ways of working are described?), I hope someone will reorganise it for non-bazaar spoken guys like me :o) .

So I've stoped working on Inkscape because of the difficulties to download trunk modifications (in fact my local branch told me there was no differencies with the trunk even when there was some... so to be sure, at each patch, I was deleting all my Inkscape folder and reimplementing my patch on up to date source code to test it... crazy no?!). If you have a really simple HOW TO for a developper that don't have the right to commit, thanks!!

Whatever, when I was developping my patch, I've tried several ways to deal with the issues in your point 1 but I've concluded that it would need a more deeper reorganisation of the code if I don't want to have a uggly (but working) solution, so I've only writed a TODO comment for a later work.

I can rework on it, I'm not afraid about code (he he), but only of Bazaar :o) .

Codain (codain) wrote :

After a deep search, the issue 1 is not linked to this bug/feature. The ClipboardManager::isEmpty() function works well but then there are some cases where functions are not 100% coded. For exemple, Inkscape is not yet able to past a text as a new object (it can only paste a text IN a selected text object) even if the ClipboardManagerImpl::getBestTarget() considers a text target can be pasted. There is a FIXME at the end of function sp_text_paste_inline().

BUT finishing this function will not be sufficient, there will be then a regression because when this function will be able to do this this will disable the "Paste color as style" feature which is in ClipboardManagerImpl::_pasteText(...) and is called when the sp_text_paste_inline return false (and here it would always return true).

So there is a tread off to have between those to features to be able to use both.

I recommand "Pasting as a new text object" feature to be not part of this bug report, and to see it as a second new feature.

For issue 2, I know why but will speak about it in its bug report.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers