perspective extension error

Bug #224989 reported by Nate Wiebe
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Undecided
Unassigned

Bug Description

i get an error when trying to apply perspective to an object. but it works when applying to an object that was converted to a path. here is the error:

Traceback (most recent call last):
  File "/usr/share/inkscape/extensions/perspective.py", line 127, in <module>
    e.affect()
  File "/usr/share/inkscape/extensions/inkex.py", line 154, in affect
    self.effect()
  File "/usr/share/inkscape/extensions/perspective.py", line 80, in effect
    solmatrix[i][0] = sp[i][0]
UnboundLocalError: local variable 'sp' referenced before assignment

Revision history for this message
Rygle (rygle) wrote :

Thanks for reporting this bug. Can you please give a set of repeatable steps to make this happen, including mentioning which tools and menu items you use? Also your operating system (I assume some sort of linux given the path references) and the version of Inkscape.

Changed in inkscape:
status: New → Incomplete
Revision history for this message
sas (sas-sas) wrote :

Steps to reproduce:

1) Draw a rectangle and a 4-node path.
2) Change to the Selector tool.
3) Select the rectangle.
4) Shift+click on the 4-node path (so that it too is selected).
5) Apply the perspective effect (Effects -> Modify Path -> Perspective).

Doesn't depend on the operating system, and probably applies to all versions of Inkscape for which the effect is available.

Extensions can't really be expected to convert objects to paths at present, because they don't have access to Inkscape's object-to-path function. Perhaps a command-line option could be added to Inkscape so that it could be called to convert a specified object to a path (although it would be better if extensions could communicate with the running Inkscape process, rather than starting up a new one).

I've attached a patch to produce a better error message (the same error message that is given if the user selects less than two objects).

Changed in inkscape:
status: Incomplete → Confirmed
Revision history for this message
Nate Wiebe (natew) wrote :

patched it and now i get a different error.

"This effect requires two selected paths. The second must be exactaly 4 nodes long."

Persepective already worked with 2 paths, and still does, but i want to add the perspective effect to objects such as photos. I've seen it done before on videos and such.

I am using Ubuntu Hardy 8.04 and the newest version of inkscape through the respitories.

Hope you can fix this one.
Thanks

Revision history for this message
sas (sas-sas) wrote :

> patched it and now i get a different error.

Yes, that was the purpose of the patch: to give a sensible error message, instead of a traceback.

Fixing the effect in the way I thought you wanted it fixed (to automatically do object-to-path) is rather difficult, for reasons I explained in my previous post.

Fixing the effect in the way I now realise you want it fixed (so that it works on photos) is a whole new ballgame. I don't think SVG provides a good way to do this (except in special cases where a transform would suffice). The obvious way to do it would be to generate a new raster image, although feDisplacementMap provides another possibility.

Revision history for this message
William Barath (w-barath) wrote :

I've made a feature request which would bring support for perspective adjustment to more of a first-class level in this application. See the "perspective" tag for a reference. It does not address the issue with perspective adjustment of raster images.

My suggestion to anyone who wants to use raster images in Inkscape is generally to convert it to vector format using the "trace bitmap" tool. Another option is to have Inkscape do something that is not entirely W3C compliant and do the perspective adjustment on the raster image anyhow (add 'redundant' tags), it would not be the only non-W3C-compliant feature of Inkscape, and it would add considerably to the DTP power of the app. Cairo should be able to handle it, hardware accelerated, so it would be blindingly faster than the vector solution.

su_v (suv-lp)
tags: added: extensions-plugins
removed: 3d
Revision history for this message
jazzynico (jazzynico) wrote :

The extension error now returns the following message (and no error traceback):
"The first selected object is not a path.
Try using the procedure Path->Object to Path."

Closing this report "Fix Released".

summary: - perspective error
+ perspective extension error
Changed in inkscape:
milestone: none → 0.47
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.