Coffe Mug Wrapping

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
astroanalyst
Posts: 9
Joined: 2015-04-04T08:26:33-07:00
Authentication code: 6789

Coffe Mug Wrapping

Post by astroanalyst »

Can IM be used to create really good life like images wrapped on coffee mugs?

See this example
http://society6.com/product/tiffany-fad ... mug#27=199


Is example done with IM or some other script?

Does anyone have an example of what they've done with cylinder wraps?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Coffe Mug Wrapping

Post by snibgo »

snibgo's IM pages: im.snibgo.com
astroanalyst
Posts: 9
Joined: 2015-04-04T08:26:33-07:00
Authentication code: 6789

Re: Coffe Mug Wrapping

Post by astroanalyst »

these scripts are ok but I was looking for a more realistic look like the link I provided.
In photoshop you would use Multiply mode to bring the light variations through.
This makes it look like the image is actually wrapped around the mug because it dips into shadow near the end of the curve.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Coffe Mug Wrapping

Post by snibgo »

I would do it in Pov-ray. Lighting, texture, surface reflectivity and so on are then much easier.
snibgo's IM pages: im.snibgo.com
astroanalyst
Posts: 9
Joined: 2015-04-04T08:26:33-07:00
Authentication code: 6789

Re: Coffe Mug Wrapping

Post by astroanalyst »

Thank you for the advice.
There site seems to be down at the moment.
Can Pov-Ray be used on the fly ....like on a website to instantly generate images on a mug?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Coffe Mug Wrapping

Post by snibgo »

I don't know if Pov-ray can be run on a server. Unless your users can upload their own mug photos, you wouldn't want to. Pov-ray can generate the displacement and lighting maps for each mug photo in advance. When a user uploads a pattern or text or whatever, IM can apply those maps.

If the users can upload their own mug photos, you have more difficult problems to solve.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Coffe Mug Wrapping

Post by fmw42 »

astroanalyst wrote:these scripts are ok but I was looking for a more realistic look like the link I provided.
In photoshop you would use Multiply mode to bring the light variations through.
This makes it look like the image is actually wrapped around the mug because it dips into shadow near the end of the curve.
You could add a gradient shading to the overlay pattern before using my cylinderize script.

When I have time, I will look into another blending mode to do the overlay, to see if I can achieve such an effect. But I cannot say when I can get to that. But it is a good idea. Of course, the coffee cup needs the shading to transfer to the pattern.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Coffe Mug Wrapping

Post by snibgo »

For the lighting, another option is to take values from the mug photo and apply those to the pattern after it is displaced to fit.

First approximation: take the mug values, auto-level, multiply this by the pattern.

For realism, specular reflections (the very shiny ones) should be handled separately because they lighten and desaturate colours.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Coffe Mug Wrapping

Post by fmw42 »

snibgo wrote:For the lighting, another option is to take values from the mug photo and apply those to the pattern after it is displaced to fit.

First approximation: take the mug values, auto-level, multiply this by the pattern.

For realism, specular reflections (the very shiny ones) should be handled separately because they lighten and desaturate colours.

With my script, one can always just output the warped texture, do something like snibo says, then composite the lighting adjusted warped texture with whatever compose method one wants (perhaps multiply or perhaps hardlight) to put it onto the mug.
astroanalyst
Posts: 9
Joined: 2015-04-04T08:26:33-07:00
Authentication code: 6789

Re: Coffe Mug Wrapping

Post by astroanalyst »

I'll have my developer look at your script... thank you!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Coffe Mug Wrapping

Post by fmw42 »

astroanalyst wrote:I'll have my developer look at your script... thank you!
It looks somewhat trivial at quick glance. I will try to test that hypothesis this week and if so, I will make a change to add an option for the compose method.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Coffe Mug Wrapping

Post by fmw42 »

I have updated my script to allow shading from the background image. There is a new argument -c compose, which is the compose method of over (as before) and multiply (new). See the last example on my cylinderize script example page.
astroanalyst
Posts: 9
Joined: 2015-04-04T08:26:33-07:00
Authentication code: 6789

Re: Coffe Mug Wrapping

Post by astroanalyst »

Thank you! I'm sending this to my developer right now to look at... that is very kind of you :)
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Coffe Mug Wrapping

Post by fmw42 »

Please respond to my PM on the forum. Thanks. Fred
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Coffe Mug Wrapping

Post by fmw42 »

astroanalyst wrote:Thank you! I'm sending this to my developer right now to look at... that is very kind of you :)
I have not heard from you in nearly a month about your evaluation. Please contact me. A license fee is due if you are using this on a commercial web site!
Post Reply