Is there a way to make the caption operation more efficient in ImageMagick? I'm creating a new image with a caption to composite onto the base image since it does not appear there is a way to position a caption directly on the base image in a specific location with a specified rendering size?
The code:
Code: Select all
cd "C:\Program Files\ImageMagick-7.0.2-Q8"
magick convert -size 980x1828 -font Arial -pointsize 54 -background transparent -fill black caption:"@pokemon.txt" rofl_arial.png
It takes 3 seconds to create an image with a transparent background using the huge section of text posted above using ImageMagick. This may not seem like a long time, but our GDI implementation in our C# web application takes .7 seconds to composite multiple images on the main image template, add a large text section to a specified area of the image, and draw other strings on the image that do NOT require wrapping. And, it produces two pages of output containing our resulting images.Today is the big day... capture a pokemon time they said. We instead ran over another player while driving. The idiot decided to cross the road to capture a wild Chansey. Little did he realize that I was trying to capture a Snorlax around the same location. The difference being that I was driving on the interstate which no one should be walking on. It's illegal. Regardless, Chansey does not show his face much, so you know, it was worth the risk to the player. Unfortunately, I ran him over and got arrested. But at least I caught my wild Snorlax. What a great day. My pokemon collection grows.
Despite the fact that I am now writing this from a jail cell, my Obama phone has not been confiscated, and I can continue to grow my Pokemon collection. No one and nothing will stop me.
If I had to do it all over again, I totally would. Another life is not worth as much as the augmented experience of capturing a wild Pokemon. There is nothing else in the world like it, and there's nothing else worth
ImageMagick takes 4 seconds to complete the rendering of just one page (caption, composite, and draw string operations). That means that ImageMagick takes more than 8 times longer to complete the same operations that GDI performs in less than a second. ASP.NET web applications should not be using GDI according to Microsoft, but there doesn't appear to be a more efficient alternative.
Breakdown of the time it takes ImageMagick (milliseconds):
Is it possible to speed up the caption operation using ImageMagick, or is this library just not very efficient with text operations? Also, allowing the image to automatically resize based on how tall the text from a caption is seems to be an expensive operation as well and just seems too slow.Draw text string onto image: 114 MS
Create caption image (with specified width and height) and then composite it on the original with a specified position: 2859 MS
Overlay 2 images: 777 MS
Sorry if this sounds a bit harsh, but I'm looking for a feasible efficient alternative to GDI, and so far, my benchmarks have shown that for our purposes, ImageMagick isn't very quick or efficient.
Any help is appreciated.