Page 1 of 3

Need help converting 3d Cover!

Posted: 2011-08-05T13:33:15-07:00
by ecoverguru
Hello guys,

I am not a pro. programmer but know quite a bit. I have a small requirement to turn a flat image into a 3d cover, I am not posting the entire image.. but just 2 parts that i am facing problem at..

I was able to use perspective but that simply throw a straight line output.. and then tried using 'BilinearReverse' and "Shephard" features but none of them helped..

Here is the flat cover

Image

and here is how the output should be..

Image

So the spine has bit curves at the bottom and top (if you look at the output in full size)... and front cover has very very slight angle where it joins the spine.

It would really be a great if someone can help me out.

Regards,

N.

Re: Need help converting 3d Cover!

Posted: 2011-08-05T14:01:37-07:00
by fmw42
see http://www.imagemagick.org/Usage/distorts/#box3d

or if using Linux/Mac, see my unix bash shell script, 3Dbox at the link below.

Re: Need help converting 3d Cover!

Posted: 2011-08-05T14:10:21-07:00
by ecoverguru
The box3d code doesnt give those finishing values... as I said the spine has bit curves or would that be called as spherize?

I am still trying.. and here is what my first attempt is.. LOL
Image

Somehow just not able to get the right coordinates. as I am not a programmer its pretty to tough to understand the stuff..

I hope I can get some help...

Re: Need help converting 3d Cover!

Posted: 2011-08-05T16:31:24-07:00
by fmw42
How did you get the above? What commands? Perhaps if we see that, we might be able get the bottom also.

An approximation woul be a cylinder distortion, though I doubt my cylinderize script will be able to help. Neither would http://www.imagemagick.org/Usage/mappin ... e_cylinder. But you may get some ideas about distortions from http://www.imagemagick.org/Usage/mapping/

Do you really need the curved spine? Is is with a single color or with an image? If a single color, then you could use -draw with straight lines for sides and arcs for the top and bottom. see http://www.imagemagick.org/Usage/draw/

Re: Need help converting 3d Cover!

Posted: 2011-08-05T16:39:53-07:00
by fmw42
see also the example and code at viewtopic.php?t=11726

Re: Need help converting 3d Cover!

Posted: 2011-08-05T16:46:17-07:00
by fmw42
perhaps you could use -draw to create a mask of the desired outline, fill it with white and put black on the outside. The use the mask to "cookie-cutter" out the shape from an image under it. That is create the binary mask image. Resize your image for the spine (after you do the perspective tranform) to the same size or vice-versa. Then put the mask into the alpha channel so that the outside is transparent.

Re: Need help converting 3d Cover!

Posted: 2011-08-05T16:48:31-07:00
by ecoverguru
I have seen that example earlier and it has straight lines no curves..

I did many tries so forgot which code generated that output.. I am trying to replicate that effect and keep you posted.. but all i know that i put some stupid values in coordinates which doesnt make sense.. anyway let me try that again.

Re: Need help converting 3d Cover!

Posted: 2011-08-05T16:51:30-07:00
by ecoverguru
Its not plain color its going to be an ecover so there are going to be gradients, images, horizontal lines in between as image

as above, it cannot be cropped either as there are going to be lines inbetween

here is the command i used to generated earlier output.

Code: Select all

exec("convert flat_cover.jpg -crop 109x802+0+0 +repage -virtual-pixel transparent -matte +distort Polynomial '1.5  \ 
	0,0 0,0   802,0 403,33   802,109 390,36   0,128 0,123' spine.png");

Re: Need help converting 3d Cover!

Posted: 2011-08-05T16:51:40-07:00
by fmw42
see my notes about using -draw above. perhaps that will give the appearance of a curved spine though only the top and bottom will be curved.

Re: Need help converting 3d Cover!

Posted: 2011-08-05T16:59:42-07:00
by ecoverguru
I understand what you are saying.. but the output wont be what it should be.

see this is how the images going to be.

Image

if we just mask that the rest of the stuff will be straight and wont give that effect

Re: Need help converting 3d Cover!

Posted: 2011-08-05T17:13:07-07:00
by fmw42
this just gives me straight sides and slanted top and bottom.


convert -size 109x802 xc:darkgreen -virtual-pixel transparent -matte +distort Polynomial '1.5 \
0,0 0,0 109,0 109,100 109,802 109,802 0,802 0,702' spine.png

Re: Need help converting 3d Cover!

Posted: 2011-08-05T17:14:04-07:00
by fmw42
ecoverguru wrote:I understand what you are saying.. but the output wont be what it should be.

see this is how the images going to be.

Image

if we just mask that the rest of the stuff will be straight and wont give that effect
You first have to do the perspective transformation, then use the mask on that.

Re: Need help converting 3d Cover!

Posted: 2011-08-05T17:41:45-07:00
by ecoverguru
Yup... but that will not give the actual curved effect to elements near the edges like the top border and the bottom... I have used the perspective method successfully but it doesnt give that perfect one..

Here is the one generated by IM

Image

But I need those perfect curves kinda bending effect (not sure whats that called) ... I tried -wave and -shear as well.. but somehow it did not work at all..

Re: Need help converting 3d Cover!

Posted: 2011-08-05T17:54:53-07:00
by fmw42
ecoverguru wrote:Yup... but that will not give the actual curved effect to elements near the edges like the top border and the bottom... I have used the perspective method successfully but it doesnt give that perfect one..

Here is the one generated by IM

Image

But I need those perfect curves kinda bending effect (not sure whats that called) ... I tried -wave and -shear as well.. but somehow it did not work at all..
That is where the mask comes in if you draw arcs at the top and bottom and straight lines for the sides (after you have done the perspective transform).

Re: Need help converting 3d Cover!

Posted: 2011-08-05T18:09:03-07:00
by ecoverguru
Here is what would happen with masking.

Image

by just cropping edges will not give the real effect...