Updated autotrace

I somehow failed to know about ‘autotrace’ for 15 years, but since Giovanni alerted me to it in another forum topic I’ve found it to be a possibly rather useful app. (If it’s unknown to others too, it’s a command-line app that generates a vector-graphic equivalent to a bitmap original.)

There was the slight problem that it either crashed or created garbage from every current TGA file I threw at it, so initially I wasn’t too impressed. However this turned out to be a bug with its handling of 32 bit/pixel targa – just about universal now, but maybe not 15 years ago. I was able to fix this, and also enable PNG input (as libpng is now standard in Haiku).

I’m fairly impressed with its precision in generating outline paths. Depends on the original of course. It will trace flat-coloured areas with precision, but will generate a lot of paths if there is shading. There are options to help, but it is probably best to do pre-processing in ArtPaint or somewhere with flood-fills and so on to flatten colours. For fun I took the old “eye/ear” BeOS logo – available on Wikipedia – flattened it a bit, and got an autotraced SVG that is a precise copy.

One main use I see is easing the creation of HVIF icons. Turn an original appropriate image into an SVG vector one, bring that into WonderBrush for editing a rough-cut of the actual icon, and move that over to Icon-O-Matic for polishing into the final form.

If anyone wants it, I’ve put it on my site (both hpkg and zip):

http://GoodeveCA.net/autotrace

and the matching sources are at:

https://github.com/PeteCA/autotrace

Hope it’s occasionally useful…

4 Likes

Thanks for sharing it!

I know we also have potrace for this:
https://github.com/haikuports/haikuports/blob/master/media-gfx/potrace/potrace-1.14.recipe

Another one I didn’t know about…! However, although potrace is a lot newer, some early play indicates that autotrace is a lot more versatile, though in some ways they may be complementary.

For a start, potrace only accepts black-and-white bitmaps (not even greyscale). Well, you can have colour – in a PPM say – but it’s just ignored. Because of that, though, it may do a better job than autotrace on such images. Strangely, the result seems to depend on the output format. I haven’t got any easy way of displaying the default EPS*, so I was creating SVGs instead. Trying the examples from the potrace site, the result was far inferior to what the site shows! (It missed complete areas, for example.) So I generated an EPS and went over to ghostscript on my old partition, and, yup, it was just like the example! (Ah – I just tried PDF output, which I can display, and it’s as good as EPS.)

Using autotrace on the potrace examples, the result was pretty good, but not quite as precise as the potrace results. OTOH, it’s quite at home with colour.

[* Is there any convenient way of displaying Encapsulated PostScript in Haiku? On my pre-PM partition I sort of have Ghostscript brought over from BeOS, but it was a bear to set up.]

I have a truly ancient GS on my repo that I managed to get working. I had to do some trickery with symlinking the hardcoded paths. Haiku Depot Server

Michel – I seem to be unable to reach your repository by following links from that page. I always end up with a 404.

[Does anybody else share my feeling that the Web is splintering? I typically access the forum with Qupzilla, because it seems to be the only browser on Haiku that will handle it. But when I tried to follow your link above I just got a lot of indecipherable garbage (bits of JS, I think). So I went to BeZilla (as it often seems to be better than WebPositive for odd sites) and it was just as bad. Finally Web+ did show the depot page, but as I say I couldn’t get the links to work (though maybe that’s at your end?). OTOH Web+ tends to not be able to show vital elements – on GitHub, for example.) Sigh.]

I suspect I have the same vesion of GS as yours. I forget exactly what I had to do pre-PM to get it to work. Have to take another look.

OK – switched tracks and grabbed your hpkg from BeShare [via AGMS as TyCom has been down all day :disappointed:].

That’s weird, Pete. You can always reach my repo directly: http://clasquin-johnson.co.za/michel/repo/packages/ for gcc2 or http://clasquin-johnson.co.za/michel/repo_64/packages/ for x86_64

Or you can try pkgman install

EDIT: just tried it from Chrome on MacOS and it works fine so the problem is in Haiku. I have noticed that recently, WebPositive is not rendering its own start page correctly, and ignoring the setting for the downloads folder…

Thanks. Yes, that works.

FTR I went from the Depot page on Postscript to the “Repository Source”, and it gives me the URL: http://clasquin-johnson.co.za/michel/haiku/repo.html which goes to 404.
I dunno…

Well, not quite it seems. The version I was using is 8.14, which is about 6 years later than your 5.5. It needs exactly the same hack as the earlier one, though: it must be in “/boot/apps”. It has an elaborate Install script, which of course no longer works.

I’ve done a short comparison of that one and the 5.5 I downloaded from you, and they seem to behave pretty much the same. Some stuff – like the ‘tiger.ps’ example – renders very nicely, but for some unknown, and annoying, reason, all text is rendered negative (white on black)! This doesn’t happen with the same code on BeOS, where everything renders properly.

If anyone wants to play with the 8.14 version, I’ve put it on BeShare [currently sitting with AGMS, as TyCom is majorly down ATM]. Two files: Ghostscript-8.14-1-x86.zip, and ghostscript-fonts-std-8.11.tar.gz

Things get murkier, though, as I also discovered on my old partition a “Ghostscript_Haiku-2013_02_25.zip” that I don’t seem to have been using. I see the 'share folder installed with all its stuff, and the libraries from the zip (including ‘libcairo’) in common/lib, but none of the executables are installed, so I must have removed them. No memory of what the problem was, but obviously I preferred the older one. Anyone have any clue?

It would be nice to have a good Ghostscript port. I was thinking it might make a good GSoC project, but the thought is a bit late…

Hi Pete;

I typically access the forum with Qupzilla, because …

I couldn’t even get HDS to function at all with Qupzilla unfortunately. This is a bit disappointing because it was working at some point. HDS is written with a single-page framework and a side effect is that it requires a fairly modern web-engine to work. For older browsers, HDS does have an option and that is the “multipage” environment. Note that this environment has limited functionality, but will support basic browsing of packages.

Finally Web+ did show the depot page, but as I say I couldn’t get the links to work
(though maybe that’s at your end?). …

Yes I think you mean the info link for the repository. @michel; if you were to give me an updated link I can amend that for you.

For what it’s worth, HDS works here with QuipZilla 1.7.0, with Qt 5.3.1.
Web+ also works, apart from uploading screenshots (icons work).

Hi Humdinger; I am on an older version of Qt which may be the problem. What happens when you try to upload a screenshot?

Should be clasquin-johnson.co.za for both repos

Just for completeness, the setup that doesn’t work on my system is QupZilla 1.8.6 and Qt 4.8.7. ( I don’t see a Qt 5 0n the depot.) Here’s the (top of the) page I see on HDS:

Anything in the Javascript console? At first glance it doesn’t look like that’s working…

Maybe I’m missing it, but I don’t see a ‘Javacript console’ in Qupzilla. Does look like a mess of bits of JS, though.

@michel; You say “both your repositories”, but I can only see “clasqm” (code) in HDS and have updated the link on that one so it should be right now and so won’t 404. What is the code of the other one?

@Pete; you can go;

  • Tools
  • Web Inspector

…to get access to the WebKit console. There does not appear to be any obvious error messages in there for me. The strange template-looking material that you are seeing in the web page are parts of the raw AngularJS templates that should be populated with data, but are not. That process must be malfunctioning on this browser somehow.

Unfortunately unless it is something obvious, I can’t expend time on it because it is probably not worthwhile. :-/

Uploading a screenshot, Web+ keeps showing the “3 busy balls”.
You had a look at it already. :slight_smile:
See ticket #12715

You have my gcc2 repo, but I also have one for x86_64: clasquin-johnson.co.za Up to you if you want to add it to the HDS. Perhaps x86_64 users are a bit more savvy and can cope with the commandline and HD app.

Ahh, thanks. I looked at that, but didn’t see anyting notable. [Interestingly, if I check on this forum page, I see a couple of “failed to load…” errors!]