Wrap an image around a glass
so that it appears rectilinear when viewed straight on
select an image
|
| |
|
Printing an image onto a glass so that it appears rectilinear when viewed straight on requires a transformation from the vertical image plane onto the unwrapped surface of the glass. If the glass is tapered normally (larger at the top), the image will not only be stretched horizontally, but will be bowed upward. If the glass is larger at the bottom, the bow is inverted. Projecting the image onto a cylindrical glass is a simpler transformation.
The diameters and height of the glass are the important measurements; the others are just for the display.
The units are arbitrary.
If the image is printed on the back of the glass, refraction starts to play a role at the very edges.
Right-click to save the wrapped image.
Be sure to save the size and position! Maybe as part of the file name.
Interpolation
(The following images: original, no interpolation (×1), upsized (×4) then reduced with bicubic, bilinear, reduced bicubic sharpened, bilinear sharpened with the same parameters. In case you’re wondering, it means “neither rashly nor timidly.”)
Bilinear interpolation reduces resizing artifacts. It is often disparaged; but properly sharpened, it can be superior to bicubic.
To get bicubic or another interpolation, upscale the projection (×4) then downscale it to 25% in an image editor using that interpolation. (Don’t judge it by the reduced display on screen; you have to save it then properly reduce it.)
A 3 × 3 inch image printed at 300 ppi would need to be 900 × 900 pixels in size; upscaled, it would be 3600 × 3600, well within the capabilities of modern browsers.
The math
A glass with tapered sides is actually a truncated cone or conical frustum.
The projection of points (x, y) on a vertical plane onto an unwrapped cone (x′, y′ )
(actually, an unwrapped half-cone, as in the front or back half; to include the entire cone, φ = 2 π r/s):
The cone angle θ is determined in this case by two radii r0 and r1 and the distance h between them:
Please visit russellcottrell.com | blog