Here you will find some interesting articles to explore in regards to business, technology, and the economy. Please feel free to contact us if you would like to comment on any of the articles we post using the contact us page.
Natanian, L. Posted July 25, 2010
Accurately centering text across multiple lines with ImageMagick is relatively easy once you discover the power of the queryFontMetrics function. Finding a tutorial on this subject however, proved to be a tediously menacing task because none of the common search engines returned any resourceful links. A topic as simple as centering text with ImageMagick should be easy to find; so I hope this tutorial fills a void for somebody else also searching to complete the same task. The meat and bones of the tutorial is to properly calculate the x and y values for the $draw->annotation($xVal, $yVal, $pLine1); function. To do so, we need to calculate the center:
$xVal = (IMAGEWIDTH / 2) - ($width_of_font_in_pixels / 2);The key ingredient missing here is knowing what the width of the font would be, and where the queryFontMetrics() function comes into play. Using queryFontMetrics, you can retrieve the width of the font (in pixels) and thusly center your image properly!
$font_info = $image->queryFontMetrics($draw, "NATANIAN.COM"); $xVal = (IMAGEWIDTH / 2) - ($font_info["textWidth"] / 2);
Do a quick var_dump of $font_info and this is what you will see something like:
array(10) {
["characterWidth"]=> float(25)
["characterHeight"]=> float(25)
["ascender"]=> float(22)
["descender"]=> float(-7)
["textWidth"]=> float(191.015625)
["textHeight"]=> float(28)
["maxHorizontalAdvance"]=> float(28)
["boundingBox"]=> array(4) {
["x1"]=> float(-0.015625)
["y1"]=> float(-0.078125)
["x2"]=> float(21.09375)
["y2"]=> float(17)
}
["originX"]=> float(190)
["originY"]=> float(0)
}
To demonstrate it: My canvas below is 378 pixels wide by 216 pixels high. For the purposes of this tutorial, I drew the center lines for visual effect:

CODE TO DRAW THE LINES
$draw->line(round(IMAGEWIDTH/2, 1), 0, round(IMAGEWIDTH/2, 1), IMAGEHEIGHT); $draw->line(0, round(IMAGEHEIGHT/2, 1), IMAGEWIDTH, round(IMAGEHEIGHT/2, 1));
Now I set up my font and my draw functions.
// ----- // Calculating the center $pLine1 = "NATANIAN.COM"; $font_info = $image->queryFontMetrics($draw, $pLine1 ); $xVal = (IMAGEWIDTH / 2) - ($font_info["textWidth"] / 2); $yVal += $font_info["textHeight"];
With queryFontMetrics, I now have my horizontal x-value, and my vertical y-value so now we are ready to write our text!
$draw->annotation($xVal, $yVal, $pLine1);
The result:

Why did you simply use $draw->setGravity(Imagick::GRAVITY_NORTH)?
Well, this method does not work very well for multiple lines because it changes the base coordinates from the top left, to the specified constant. In other words, all your lines will be centered due north as such:

I would love to hear feedback in regards to this tutorial I posted to improve it. Please feel free to use the contact page to get a hold of me and let me know if I should expand on any section. I also would welcome your solutions to aligning lines across an image--and of course, I will give credit where credit is due!
Natanian, L. Posted December 11, 2009
Social networking websites are the most commonly requested quote we receive at Natanian.com, and we found it valuable to explore these requests more in depth. Since our approach to web development is partnering with our clients, we decided to investigate the financials of the industry to further identify workable ideas from nonworkable ones. Unfortunately, the majority of social networking sites are privately held and therefore it is difficult to find a reliable source for information. In this article, we decided to present some financial figures on Facebook because unbeknownst to most, Facebook—the largest social networking website—has been losing money since its inception. Facebook announced only this year (2009) that it turned a profit, but even that is suspect considering it had an injection of over $200 million from a Russian investment firm this year as well. Ignoring operating costs, below is a table of gross estimated revenue from the most reliable sources we were able to find. As you can see, we estimate that Facebook earns roughly $1.50 to $2.00 per user per year—comparitively, Yahoo earns roughly $33 per user per year and Google earns $55 per user per year.
| Facebook Estimated Revenues | ||
| Revenue¹ ³ | 2009 | 2010 |
| brand ads | $125,000,000 | - |
| deal w/ Microsoft | $150,000,000 | - |
| virtual goods | $75,000,000 | - |
| self-service ads | $200,000,000 | - |
| Total Revenue | $550,000,000 | $750,000,000 |
| Estimated Users² | 350,000,000 | 350,000,000 |
| Revenue Per User | $1.57 | $2.14 |
¹ Carlson, N. (2009, July 9). Everything You Wanted To Know About Facebook's Revenue But Didn't Know Who To Ask. Retrieved December 11, 2009, from The Business Insider: http://www.businessinsider.com/breaking-down-facebooks-revenues-2009-7
² Facebook. (n.d.). Facebook Statistics. Retrieved December 11, 2009, from Facebook: http://www.facebook.com/press/info.php?statistics
³ Wall Street Journal. (2009, December 7). Think Again / A Second Look at Sectors and Stocks. Wall Street Journal. (Europe). Brussels , p. 20.