Re: Clip path problem when saving TIFF as a transparent PNG
Posted: 2014-06-07T03:51:50-07:00
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?
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?