(Apologies for using this post to get my thoughts straight about a few things, and most likely being way too technical.)
Because you are enlarging by exactly 2 with the default image size convention of IM ("match corners") which is the best for integer enlargements (except possibly if you care about what happens near the boundary), what you really want (and what you get anyway if the alignment is just right, which it automaticaly is with -resize; distort is in a state of flux as far as resizing goes so...) is a so-called vertex-split subdivision method.
That I know, they are not implemented in IM. Not that they necessarily should be: They are a pain to program for general resampling or resizing without using recursion, and they only work better than standard filtering methods in fairly specific cases (namely, enlargement by a small power of 2). Yours is likely to be one of those specific cases. (You are only going "up one level," so no recursion needed.)
So, let me make two suggestions made with an awareness of the fact that, whether you like it or not, what you will get, and what you need, is a vertex split subdivision method: One which is fairly straightforward, and one which relies on distort but may give a better result (but for which I need some IM programming help: I know the internals of IM way more than its API).
: These suggestions are likely to give TERRIBLE results for anything but enlargement by a perfect factor of 2 with exactly the default image size convention of IM.
: Take the most likely candidate filters (Triangle, Hermite, Gaussian, Cubic or even Point, in that order, if you don't want any haloing, Mitchell (the default), Catrom, Lanczos2 and Lanczos if you are OK with some).
One filter at a time, compute ($FILTER is the filter you are trying, $BLUR is the value of the blur you are trying)
Code: Select all
convert in.png -filter $FILTER -define filter:blur=$BLUR -resize 200% out$FILTER$BLUR.png
for blur values between about .5 and 1.5 (depending on the filter, some of the values at either end will suck big time) and inspect them visually.
For example, for moderate enlargements (2x), I kinda like -filter Triangle -define filter:blur=1.33333333333333.
When you've honed in on an OK filter/blur combination, refine by trying blur values close to this value. You'll be amazed at how much difference changing the blur by .1 can make with some filters.
(To do this, you don't need a recent version of IM: It relies on -resize, which has been stable in terms of results, for some time. Lanczos2 is the only "new" thing and you can get it with selecting 2 lobes.)
My favorite vertex-split subdivision method is the midedge method, which I think would work well for your image.
One can emulate midedge using filters by adding .25 times the result of
... -resize -filter Point ...
and adding .75 times the perfectly aligned result of
... +distort -filter Point -define filter:blur=1.6 ...
(Unless I am mistaken RE: the way Point is automatically modified for distort, 1.6 a correct blur because 1.6*.5=.8 is between sqrt(5/8) and sqrt(9/8), which selects the three closest input points for each of the subdivision points. blur=2 should work too.)
If I can find another minute (profs are paid for pontificating, not programming) I'll figure out how to do the full coding.
Note to Anthony (and Fred):
This kind of emulation of one level of a subdivision method with filters is actually kind of cool (if I say so myself). Maybe it should go in the examples (once the exact code is nailed down)? Then, for the special case of enlarging by a factor of 2, people would have access to these kinds of method. Of course, by chaining the operations, they would also get 4, 8...