Page 1 of 1
Gravity center + annotate behavior change in 6.9.2-3
Posted: 2015-09-23T17:55:03-07:00
by sam.saffron
We use the awesome Image Magick for letter avatar generation at Discourse, recently we upgraded from 6.9.1-3 to 6.9.2-3
See more at:
https://meta.discourse.org/t/letter-ava ... date/33671
We use the following command to create letter avatars
Code: Select all
convert -size 360x360 xc:'rgb(198,125,40)' -pointsize 280 -fill '#FFFFFFCC' -font 'Helvetica' -gravity Center -annotate -0+26 'A' -depth 8 'avatar.png'
Letter was perfectly centered in 6.9.1 but now requires a +42 offset (as opposed to +26) to be in the middle.
Any ideas what happened here?
Is there a format here that will render the same image on both 6.9.2 and 6.9.1 ?
Re: Gravity center + annotate behavior change in 6.9.2-3
Posted: 2015-09-24T09:59:24-07:00
by fmw42
What do you mean by "in the middle"? If the letter A is rendered with -annotate +0+0, it is not rendered to be centered. That is a property of the font metric for that letter and font.
I added -debug annotate to my command with -annotate +0+0 and get
Code: Select all
Metrics: text: A; width: 183.891; height: 280; ascent: 216; descent: -65; max advance: 420; bounds: 4.10938,0 183.344,200.5; origin: 187,0; pixels per em: 280,280; underline position: -3.20312; underline thickness: 1.57812
2015-09-24T09:53:15-07:00 0:00.000 0.000u 6.9.2 Annotate convert[409]: annotate.c/RenderFreetype/1252/Annotate
Font /System/Library/Fonts/Helvetica.dfont; font-encoding none; text-encoding none; pointsize 280
Can you post examples of the results of your command using -annnotate +0+0 from your two versions of IM?
Perhaps you have a change of version of one of the font delegates such as freetype or fontconfig.
Re: Gravity center + annotate behavior change in 6.9.2-3
Posted: 2015-10-04T23:39:02-07:00
by womble
I work with Sam at Discourse, he's asked me to dig into this. Fun times...
I've bisected the commit that introduced the problematic behaviour to 61315aae, which refers to
viewtopic.php?f=3&t=27451. Interestingly, I can still reproduce the problem referenced in that thread with current HEAD (b94400f5). As an added bonus, of course, it also causes the problems we're seeing...
As far as generating examples with -annotate +0+0, images generated with -annotate +0+0 are identical; the problem only presents itself for annotations we make offset. The problem is that a lot of our annotations have to be made with an offset, because for reasons unknown the "centre" of the letter isn't really the centre.
For the command Sam originally posted, here are the resulting images:
On 234ea93e:
On b94400f5:
Re: Gravity center + annotate behavior change in 6.9.2-3
Posted: 2015-10-05T03:28:53-07:00
by magick
We can reproduce the problem you posted and have a patch in ImageMagick 6.9.2-4 Beta available by sometime tomorrow. Thanks.
Re: Gravity center + annotate behavior change in 6.9.2-3
Posted: 2015-10-08T02:40:55-07:00
by womble
I can confirm that d11120d no longer exhibits the issue we were having. Thanks for the quick fix!