Page 1 of 1

Engravings on a circular object

Posted: 2015-09-16T06:08:55-07:00
by masqurado
Hey Everyone!

I'm completely new to the forum and I've just started to begin to discover imagemagick. I'm sorry if this question has been asked before, but I've searched the forum as thoroughly as I could but could not find what I'm looking for.

So here's my question: I'm working on a project where we're building a website similar to the one linked below. They have a pretty cool custom engraving option that allows you to visualize any text on a piece of jewellery. Now while this may seem striaghtforward, what I cannot seem to find is how they've managed to:

A. Fit the text in a particular area of the product only.
B. For the text to be shaped according the piece of jewellery (where the jewellery is arc shaped, the text is arc shaped too. Likewise the visualizer basically adjusts the image according the text entered by the customer)

Is this something that is being done/is possible using ImageMagick?

What's fascinating is that it applies to all the images of the product being displayed.

Would love to hear from all of the experienced folk here :)

Here is the link of the customizer:
  • https://www dot jewlr dot com / products / JWL0024-double-baguette-bypass-ring
Just click the engraving option to see it in action.

Re: Engravings on a circular object

Posted: 2015-09-16T09:24:46-07:00
by fmw42
You could fake it by using text to image to write text on a (transparent) background. Then a combination of barrel, perspective and/or arc distortions. Then composite that result onto your background ring image. See

http://www.imagemagick.org/Usage/text/ (see label:)
http://www.imagemagick.org/Usage/distorts/#barrel
http://www.imagemagick.org/Usage/distorts/#perspective
http://www.imagemagick.org/Usage/distorts/#arc
http://www.imagemagick.org/Usage/compose/#compose

or I have a Unix shell script that does cylinder warp, (cylinderize), at my link below. However, right now, it does the front side of the cylinder. It might need customizing to do the back side with an invisible front side.

Here is a simple example of barrel distortion to create a pinch effect.

Code: Select all

convert -pointsize 24 -background none -font verdana label:"Joe Smith" \
-virtual-pixel none -distort Barrel "0.0 0.0 0.0 1.0   0.0 0.0 -0.1 1.1" \
barrel_pinch_text.png
Image



Here is one that does the barrel distort and then a wave distort

Code: Select all

convert -pointsize 24 -background none -font verdana label:"Joe Smith" \
-virtual-pixel none -distort Barrel "0.0 0.0 0.0 1.0   0.0 0.0 -0.1 1.1" tmp1.png
wlen=`convert -ping tmp1.png -format "%[fx:2*w]" info:`
amp=`convert -ping tmp1.png -format "%[fx:0.2*h]" info:`
convert tmp1.png -background none -wave ${amp}x${wlen} -trim +repage barrel_pinch_wave_text.png
Image

Re: Engravings on a circular object

Posted: 2015-09-17T03:10:09-07:00
by masqurado
Thank you so much for this! This is really useful.