I think that always changing V to Q (or anything else) is asking for trouble.
According to the standard (http://www.w3.org/TR/SVG/paths.html), V is valid and should be followed by any number of y-coordinates. Q needs a multiple of 4. Under your scheme, if a V command has an odd number of coordinates, would that be converted to an invalid Q? If it had 4 valid y-coordinates, by replacing V with Q, half the y-coordinates would be interpreted as x-coordinates. For the bad files I have seen, this would be a good action, correcting them, but there may be many thousands of good files out there that use V correctly.
I think that if you add a feature that converts V to Q (or anything else), it must be switchable, under the user's control. And it should never create invalid Q commands, ie it must only convert to Q if the number of coordinates is a multiple of 4.
Changing Y to anything is less problematic. It isn't valid SVG.
If I had to convert thousands of files with clip paths, I would experiment:
1. Count the number of files that have neither Y or V; Y but not V; V but not Y; both Y and V.
2. Count the number of coordinates after V. Is it always a multiple of 4?
3. Examine the coordinates after V, and compare them to nearby commands. Do the coordinates looks like (x,y) pairs or a series of y-coordinates?
Clip path problem when saving TIFF as a transparent PNG
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Clip path problem when saving TIFF as a transparent PNG
snibgo's IM pages: im.snibgo.com
Re: Clip path problem when saving TIFF as a transparent PNG
I am not sure if you are aware of this but 'we' (ImageMagick) create the SVG from information stored in the 8 bim profile. The file does not contain an embedded SVG file it only contains coordinates that we use to create an SVG file.
The part that writes the V will always write an x,y followed by another x,y. The V part is now interpreting the x coordinates as y coordinates. This looks wrong to me. Changing this to Q looks like the correct solution.
The part that writes the V will always write an x,y followed by another x,y. The V part is now interpreting the x coordinates as y coordinates. This looks wrong to me. Changing this to Q looks like the correct solution.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Clip path problem when saving TIFF as a transparent PNG
Ah. On the previous page, I speculated that Photoshop was generating the bad SVG. But it's really ImageMagick? Then, yes, clearly it should be corrected. I don't know what it should use instead of V and Y. It depends on the semantics of the 8bim profile, I suppose.
snibgo's IM pages: im.snibgo.com