Hi!
jiho wrote:
The is a tracing function in Inkscape in Path > Trace bitmap. The differences are that in Inkscape:
- you get a small bitmap preview of the trace result before doing the
actual trace. From my point of view this allows to work on small machines while redoing the complete tracing each time you change a parameter (i.e as in Illustrator) is probably very resource hungry. The bitmap preview is not autoupdated so that's not exactly "Live" but the update is just a click of a button away.
Inkscape's Trace has a small set of "filters" that preprocess the source image and convert it to a form usable by Potrace. Potrace only does tracing of black and white images (which is good, I think: do one job, and do it better than anyone else on the planet. Peter Selinger is a genius). So Trace takes the selected GdkPixbuf and converts it into a black&white internal version that Potrace can use. The Preview image is a temporary GdkPixbuf copy of that interval bitmap that we make to be displayed to the user.
It is a special case for color multiscan. There is an internal indexed-color bitmap from which we generate the black and white layers for the individual scans. For Preview, we make a GdkPixbuf from this indexed-color bitmap.
But in either case, Preview is making a GdkPixbuf copy for the user of what Potrace will see.
- the preview is in the Tracing window rather than on canvas.
This is interesting. We might want to look at this. This might not be any more trouble than how we currently transform the output svg to overlay the original image. A nice benefit would be that we could get rid of the Preview area on the dialog.
Of course, putting the preview image on the document would mean adding and removing images on the document tree, so there might be issues with that.
- there are not tracing presets as in Illustrator but I guess these
should not be too hard to make
- the color mapping (map the trace colors to a palette) does not
exist (and the functionality is pretty cool actually see http:// www.creativecow.net/articles/mcmahon_frank/livetrace/livetrace.htm ) So there are less bells and whistles but the main functionality is there.
Currently it does octree quantization of the source image, to make an indexed color image (similar to a GIF) with colors that most closely fit, in color distance, the pixels of the original image.
If we did it with color swatches, then I suppose the number of swatches selected would be the number of scans and number of colors in the indexed-color bitmap. Instead of quantization, we would just copy the colors of the swatches to the color table. But we would still need to color-distance map the source pixels to the swatch colors. This would be tougher to code in the GUI, but would actually use a little less cpu.
From a developer point of view:
- what about auto-updating the preview when the parameters are
changed? IMHO that would slow down things too much but maybe an auto- update checkbox would be nice for people on bigger machines than mine.
Yes, this would definitely use more CPU. The single-scan filters would not be so bad, but quantization and color multi would take a lot.
Doing a Preview each time a radio button or check box is changed to alter the type of filter would be OK, I think. Doing a Preview every time the number changed in one of the numeric spinboxes would be awful. Maybe only doing it on the release of a spinbox would work.
- how hard would it be to put the low resolution bitmap preview of
the trace on canvas rather than in the trace dialog? This would be a nice feature and would probably ease things very much when it comes to docking the trace dialog.
(above)
- the color mapping feature is really nice and probably handy in some
situations (e.g. I am doing a flyer with a defined color palette and I want to integrate a traced bitmap). I don't see any color mapping options in potrace so I guess this would require some substantial changes to potrace. Alternatively an extension which would map all colors in selected objects to their closer match in the selected swatches set would probably be very nice in many situations and not just on a traced object (I am thinking of cliparts imported from OCAL for example).
(above)
Those are good ideas. The idea of allowing the user to pick the colors of the multiscan has been mentioned before. But I think that the swatch GUI would really help this to be a reality. And it would not be so bad to get rid of the Preview area on the Trace dialog. It has always been an awkward size and shape for the dialog. Just look at the Preview button! :-)
bob (ishmal)