home *** CD-ROM | disk | FTP | other *** search
/ Commodore Free 10 / Commodore_Free_Issue_10_2007_Commodore_Computer_Club.d64 / t.potrace < prev    next >
Text File  |  2023-02-26  |  10KB  |  341 lines

  1. u               Potrace
  2.    Open source tracing application
  3.       Frequently Asked Questions
  4.  
  5. My first name for this program was
  6. "pbm2eps", which was very lame and
  7. also inaccurate, because both the
  8. input and output file format might
  9. evolve over time. So I started looking
  10. for a cooler name.
  11.  
  12. Since this program does tracing, I
  13. wanted a name with the word "trace" in
  14. it. I did a Google seach for each
  15. combination "atrace"..."ztrace" of a
  16. single letter plus "trace". Believe it
  17. or check for yourself: every single
  18. one of them was already taken by some
  19. other software!
  20.  
  21. Most of them were something boring,
  22. like the name of a function in some
  23. obscure statistics package written in
  24. Fortran. If I remember correctly, the
  25. only exception was "ytrace", which
  26. brought up a foreign language porn
  27. site called "sexo con perros"
  28.  
  29. I am not sure what "ytrace" might mean
  30. in some foreign language, but I have a
  31. pretty good idea what "sexo con
  32. perros" means, and so I didn't want to
  33. take any risks giving this name to my
  34. program.
  35.  
  36. So I started looking for 2-letter
  37. combinations. It so happens that
  38. "potrace" didn't yield any hits on
  39. Google, except a few sites that had
  40. misspelled the word "podrace" (as in
  41. pod-racing) from Star Wars Episode I.
  42. This was okay, I thought, and would
  43. not attract any trademark infringement
  44. suits. So I settled for the name
  45. Potrace. I particularly like this name
  46. because it can also mean
  47. "polygon-based tracer", which actually
  48. describes quite accurately what
  49. Potrace does.
  50.  
  51. By the way, it is pronounced
  52. "po-trace", not "pot-race". If it
  53. conjurs up mental images of people
  54. running around a track with cooking
  55. pots, then you are not pronouncing it
  56. correctly.
  57.  
  58. Question: Is there a mailing list? How
  59. can I be notified of new releases?
  60.  
  61. Answer: There is currently no Potrace
  62. mailing list. However, Potrace has a
  63. project page at Sourceforge.net. This
  64. page provides a discussion forum, as
  65. well as a mechanism for reporting
  66. bugs. To be automatically notified of
  67. new Potrace releases, go to the
  68. Potrace project page on
  69. Sourceforge.net, find the section on
  70. "Latest File Releases" and click on
  71. the little envelope icon under
  72. "Notes/Monitor" Basic usage and errors
  73.  
  74. Question: Can you show me the options
  75. used to generate the examples pictures
  76. on the Potrace website? I tried to do
  77. it myself, but failed.
  78.  
  79. Answer: All the examples were
  80. generated with the default settings.
  81. The EPS files were generated by the
  82. following command: cat file.pbm \
  83. potrace > file.eps but the following
  84. also works: potrace file.pbm
  85.  
  86. The input to Potrace in each of these
  87. examples was a PBM file. But since
  88. most browsers can't display PBM, I
  89. posted the images in PNG format on the
  90. website, and I also scaled them. You
  91. need to shift-click on the left-hand
  92. side image to download each original
  93. PBM file.
  94.  
  95. The greymaps were generated by this
  96. command:
  97.  
  98. cat file.pbm \ potrace -gx2
  99.  
  100. This generates a PGM file. Again, for
  101. posting on the web, I have further
  102. translated this to the PNG format by
  103. piping the output through pnmtopng.
  104. For experts only: If you want to know
  105. exactly how I processed these files,
  106. you can look at the Makefile that I
  107. used.
  108.  
  109. Question: I installed and ran Potrace,
  110. and it did not work. I got the error
  111. message: sh: line 1: compress: command
  112. not found. What am I doing wrong?
  113.  
  114. Answer: This error occurs only with
  115. Potrace version 1.3 or earlier. When
  116. this happens, you should either
  117. install the newest version of Potrace,
  118. or else run your existing version with
  119. the -c option, and everything should
  120. work fine.
  121.  
  122. Question: How can I improve the
  123. quality of the output of Potrace?
  124.  
  125. Answer: The most effective way to do
  126. so is to improve the quality of the
  127. input! This seems obvious, but not
  128. everybody thinks of this. Scan your
  129. image at a higher resolution. Scan
  130. your image in greyscale, and use a
  131. program such as mkbitmap to generate a
  132. high-resolution bitmap to trace.
  133.  
  134. In some cases, it also helps to
  135. decrease the resolution of the input
  136. image. If the resolution of your input
  137. file is incredibly high, the output
  138. generated by Potrace might be larger
  139. than necessary. This also sometimes
  140. happens if the input is speckly or
  141. noisy. Rather than trying to simplify
  142. the vector image, it often helps to
  143. just downscale the input bitmap.
  144.  
  145. Question: How can I reduce the number
  146. of nodes in the output of Potrace?
  147.  
  148. Answer: Potrace already makes an
  149. attempt to reduce the number of nodes,
  150. and this behavior is controlled by the
  151. --opttolerance parameter (or can be
  152. turned off entirely with --longcurve).
  153. However, I have decided not to
  154. sacrifice quality for quantity, and
  155. Potrace will not reduce the number of
  156. nodes beyond what it considers
  157. tolerable.
  158.  
  159. For many applications, the problem of
  160. reducing output file size can be
  161. solved by reducing the resolution of
  162. the input image. This sounds too
  163. simple to be true, but can give
  164. surprisingly good results. One of the
  165. most common "beginner's mistakes" when
  166. using Potrace is to start with an
  167. image that contains too much detail or
  168. noise. Blurring the input image can
  169. also help, particularly with grey-
  170. scale images.
  171.  
  172. 3. File formats Question: Why can
  173. Potrace not read/write PNG files? It
  174. is such a popular file format.
  175.  
  176. Answer: In keeping with the old unix
  177. philosophy "write programs that do
  178. only one thing and do it well", I am
  179. trying to avoid writing a front end
  180. for every possible graphics file
  181. format known to mankind. Instead, I
  182. provide support for asmall number of
  183. generic formats which are easy to
  184. convert to and from.
  185.  
  186. The PNG format is relatively complex
  187. to implement, and there already exist
  188. many excellent programs for converting
  189. between PNG and the PNM format which
  190. Potrace can read. See the next
  191. question.
  192.  
  193. Question: What programs can read/write
  194. PBM files on Linux? Gimp does not seem
  195. to help me... How can I convert PNG to
  196. the formats that Potrace can read?
  197.  
  198. Answer: Gimp, unfortunately, cannot
  199. write PBM files (although it can read
  200. them) .However, Gimp can write PNM
  201. files, as well as BMP files. Both file
  202. formats are understood by Potrace
  203. version 1.1 or later. Note that the
  204. files have to be bitmaps, i.e., they
  205. should only use two colors black and
  206. white. All other colors or grey values
  207. will be converted to black and white
  208. before Potrace begins its processing.
  209.  
  210. A good program for converting anything
  211. to PBM is the convert command line
  212. utility of ImageMagick. It is invoked
  213. simply as "convert inputfile
  214. outputfile" . It is pre-installed on
  215. many systems, and can otherwise be
  216. obtained from www.imagemagick.org. The
  217. output format is determined by the
  218. filename extension, so for converting
  219. to pbm, you simply type:
  220.  
  221. convert image.png image.pbm
  222.  
  223. Another very useful such set of
  224. command line utilities for converting
  225. different image formats are the
  226. "netpbm" utilities, see
  227. netpbm.sourceforge.net. Again, these
  228. tools are preinstalled on many popular
  229. systems. They allow you to convert
  230. between file formats on the command
  231. line. Particularly useful are pngtopnm
  232. and pnmtopng, but you can also convert
  233. to and from other formats using e.g.
  234. giftopnm, anytopnm and so forth. You
  235. can use these commands in a pipeline,
  236. for instance
  237.  
  238. cat file.png \ pngtopnm \ potrace >
  239. file.eps
  240.  
  241. Question: I am working to add Potrace
  242. support to another program, but the
  243. output of Potrace leaves me a little
  244. stumped. How can I parse the output of
  245. Potrace into some format which my
  246. program can use?
  247.  
  248. Answer: To get parseable output from
  249. Potrace, I suggest using the -q and -
  250. c options. The default output is
  251. optimized for size, not readability.
  252. With 'potrace -qc', you should get
  253. exactly what you need.
  254.  
  255. If you use the output from Potrace for
  256. processing by another program, I also
  257. recommend increasing the output
  258. resolution, e.g., -u=100 or -u=1000,
  259. to reduce the effect of roundoff
  260. errors. Note that the output
  261. coordinates correspond to input
  262. (bitmap) coordinates, multiplied by
  263. the unit length, then rounded to
  264. integers.
  265.  
  266. 4. Color Question: Can Potrace handle
  267. color images?
  268.  
  269. Answer: The short answer is "no".
  270. Potrace can only handle 2-valued
  271. images at the moment. It does not
  272. matter whether the two colors are
  273. called "black" and "white" or "on" and
  274. "off" - however, there can be only two
  275. of them.
  276.  
  277. Question: Will color support be added
  278. to Potrace in the future?
  279.  
  280. Answer: Maybe.
  281.  
  282. Question: How can I work around the
  283. lack of color support?
  284.  
  285. Answer: There are many ways in which
  286. Potrace can be useful in processing
  287. color images, with some extra work.
  288. For example, you can trace an image to
  289. SVG format using the --svg and
  290. --opaque options, and then use e.g.
  291. Sodipodi or Inkscape to color it
  292. manually.
  293.  
  294. Or you can extract individual color
  295. components from your image using the
  296. Gimp or ppmcolormask (part of the
  297. netpbm package), trace them
  298. separately, and then overlay the
  299. pieces to get a multicolored image.
  300. You can get pretty good results for
  301. posterized images. I have used a
  302. command line similar to this:
  303.  
  304. cat img.gif \ giftopnm \ ppmcolormask
  305. #641b1b \ potrace
  306.  
  307. Recent versions of Inkscape have a
  308. built-in Potrace engine that can
  309. handle color images via color
  310. quantization or multiple scanning,
  311. thanks to the great work of Bob
  312. Jamison and the Inkscape team.
  313.  
  314. Another interesting application of
  315. Potrace to color images is described
  316. in the fascinating article Automatic
  317. Generation of Stained Glass from
  318. Scanned Photos by C. Scott Ananian.
  319. Graphical user interface
  320.  
  321.  Question: I don't like command line
  322. utilities. Is there a graphical user
  323. interface for Potrace?
  324.  
  325. Answer: Yes, there are now several
  326. graphical user interfaces (GUI's) for
  327. Potrace, contributed by various other
  328. people. There are GUI's for Linux and
  329. for
  330.  
  331. Mac OSX. I have not tried them myself,
  332. so I cannot say if they work or if
  333. they have all the features you want. I
  334. suggest to try them out. Please look
  335. under GUI's and related software on
  336. the main Potrace web site.
  337.  
  338.  
  339.  
  340. ...end...
  341.  
  342.