Page 1 of 2
Create 3D Image (isometric)
Posted: 2009-08-20T04:40:45-07:00
by Maraumax
Hi,
I want to create 3D image but i don't know if it's possible with ImageMagick. Actually I use it for scale and rotate image but i want to create an "isometric" image.
Actualy i have that : (with convert * -rotate 4 *)

From :
Do you know how i can have that :
I view
that and I think i can use it.
Thanks for your help and sry for my bad english.
Re: Create 3D Image (isometric)
Posted: 2009-08-20T10:13:07-07:00
by fmw42
see my script 3Drotate or rotate3D at
http://www.fmwconcepts.com/imagemagick/index.html
also see Anthony's examples on isometric and perspective at
http://www.imagemagick.org/Usage/distorts/
Re: Create 3D Image (isometric)
Posted: 2009-08-20T11:31:14-07:00
by Maraumax
Good work !
I think i will test
Rotate3D &&
3Drotate (I also view
skew)
But i dont know how install this new scripts. Just past file in "/usr/lib/ImageMagick-6.3.7/modules-Q16/coders" ?
Thx.
EDIT : I understand

Now i test.
EDIT 2 : Do you know method for change widh % picture points ?
Example :

Re: Create 3D Image (isometric)
Posted: 2009-08-20T13:23:59-07:00
by fmw42
sorry your questions are unclear.
Are you asking about the use of the scripts 3Drotate or rotate3D? These are bash, unix scripts and may not work on Windows without major changes or the use of Cygwin.
Or are you asking something totally different about the use of control points in the -distort perspective?
If the latter, see
http://www.imagemagick.org/Usage/distor ... rol_points
Re: Create 3D Image (isometric)
Posted: 2009-08-20T21:07:46-07:00
by anthony
Re: Create 3D Image (isometric)
Posted: 2009-08-21T02:29:50-07:00
by Maraumax
Yeah ! Actually i use PHP for make reflexion. I think it's better (?) with imagick.
If I want to use it, what exact command i must be use ?
Code: Select all
convert pokemon.gif -alpha on -virtual-pixel transparent -filter point\
\( -clone 0 \
+distort Perspective '0,0,0,0 0,64,0,64 64,0,54,10 64,64,54,54' \) \
\( -clone 0 -channel A -evaluate multiply .35 +channel \
+distort Perspective '0,0,0,128 0,64,0,64 64,0,54,98 64,64,54,54' \
\) -delete 0 +swap -background none -layers merge \
+filter -size 100x100 xc:black +swap \
-gravity North -geometry +0+5 -composite reflect_distort_sep.png
I dont understant how make with "\" in my shell. Can you help me ? I must be install script ?
@fmw42 : Bad explication, sorry ^^ But I think i can make what i want with your link.
thank you to you
EDIT : I test but i hav'got "convert: unrecognized image filter `point('." error.

I think i must be add "point" script. Where i dl it ? Where i place it ? Thanks.

Re: Create 3D Image (isometric)
Posted: 2009-08-21T11:46:27-07:00
by Maraumax
Sry for my up but i edit
my message.
Thanks.
Re: Create 3D Image (isometric)
Posted: 2009-08-21T14:31:23-07:00
by fmw42
change
convert pokemon.gif -alpha on -virtual-pixel transparent -filter point\
to
convert pokemon.gif -alpha on -virtual-pixel transparent -filter point \
You must have a space before \. The \ is a line continuation in unix. It is also used as a an escape character and is needed before either ( or ). see
http://www.imagemagick.org/Usage/basics/#image_seq
If you are on windows, then you must use ^ rather than \
See
http://www.imagemagick.org/Usage/windows/
But if on windows, my scripts won't work unless you have something like Cygwin installed and any necessary unix like operators such as bc, grep, awk, sed, etc
Re: Create 3D Image (isometric)
Posted: 2009-08-21T14:34:12-07:00
by fmw42
I dont understant how make with "\" in my shell. Can you help me ? I must be install script ?
@fmw42 : Bad explication, sorry ^^ But I think i can make what i want with your link.
Sorry, but I am not sure what you are asking me?
My scripts are bash unix shell scripts.
Just download, remove the .sh or call by name.sh. they are just text files. the set execute permissions
chmod u+x scriptname
But you may need to include the full path to the script and the full path to any images (input or output)
to call the script
bash fullpathto/scriptname arguments fullpathto/input fullpathto/output
Re: Create 3D Image (isometric)
Posted: 2009-08-21T17:35:02-07:00
by Maraumax
@fmw42 : I didn't understant for the "/". Now it's ok (for it only ^^)
I have just a small problem. Explication with picture :

-->
Red to blue. But when i run this code :
Code: Select all
convert /*censored*/tr2.jpg -matte -virtual-pixel transparent \
-distort Perspective \
'0,135 0,135 0,220 32,220 180,180 212,180 180,110 180,110' \
/*censored*/tr2.jpg
my picture is :
How to just distorting reflect ?
My global code is :
Code: Select all
# Dégradé
convert /*censored*/11858.jpg \
\( +clone -flip -fill white -colorize 50% \) -append \
-size 180x220 xc:white +swap \
-gravity North -composite /*censored*/tr2.jpg
# Isométrique
convert /*censored*/tr2.jpg -matte -virtual-pixel transparent \
-distort Perspective \
'0,0 0,0 0,220 0,220 180,220 180,180 180,0 180,0' \
/*censored*/tr2.jpg
# convert /*censored*/tr2.jpg \
# -draw 'fill none stroke blue polygon 0,135 32,220 212,180 180,110' \
# /*censored*/tr2.jpg
# Isométrique - Dégradé
convert /*censored*/tr2.jpg -matte -virtual-pixel transparent \
-distort Perspective \
'0,135 0,135 0,220 32,220 180,180 212,180 180,110 180,110' \
/*censored*/tr2.jpg
Merci ! Thanks !
Re: Create 3D Image (isometric)
Posted: 2009-08-21T17:55:24-07:00
by anthony
Distort distorts the WHOLE image, The control points define how to distort the WHOLE image.
Also WHY do you are to make that change in the reflection. IT is a illogical and (in the real-world) an impossible reflection! Reflections always reflect toward the user. ONLY shadows are distorted in other directions!
See the link I gave previously, which has bold rules about how reflections work.
HOWEVER, if you still want to do this impossible reflection, then you need to separate and distort the reflected image as a completely separate image, then merge it when finished.
That is from the original image distort just that image to its final position.
Then starting with the original image 'attenuate' the colors, and distort it to form the reflected image,
Now merge the two separately distorted images together.
Re: Create 3D Image (isometric)
Posted: 2009-08-22T04:35:07-07:00
by Maraumax
Thank you!
I understand and it is true that I am not logical.
Everything therefore seems correct except a small point, I do not know if it is possible to improve the quality (focus) of the image? I tried with "-quality 100" associated to convert but it changes nothing.
Thank you for that answer and for your continued good sites / books and imagemagik very interesting!
Re: Create 3D Image (isometric)
Posted: 2009-08-22T09:05:48-07:00
by fmw42
use -filter option or supersampling
see
http://www.imagemagick.org/Usage/distorts/#super_sample
http://www.imagemagick.org/Usage/distor ... a_resample
-distort perspective has area resampling on by default to antialias things in the distance. you can disable it and use -filter point or -filter lanczos or -filter bilinear to have normal resampling, but you may get aliasing and moire patterns where minification occurs.
Supersampling will take longer but will produce a higher quality result.
Re: Create 3D Image (isometric)
Posted: 2010-10-10T19:52:31-07:00
by whosleonard
how do I install imagemagick 3drotate on a windows computer. I have cygwin running on local computer. thanks
Re: Create 3D Image (isometric)
Posted: 2010-10-10T21:06:28-07:00
by fmw42
If you have cygwin correctly installed and IM Cygwin installed and you have your directories set up properly, then you just download the script and run it as instructed in the header of the file. Also see the pointers at
http://www.fmwconcepts.com/imagemagick/index.php for Windows users. You also may have to edit the file to change the default directory from "." to "/tmp" and to provide the full path to convert or other IM function. You may also need several unix tools such as bc, expr, sort, sed etc that may or may not come with cygwin. Be sure to reference paths in the unix way with / and not \.
Sorry I cannot help much as I am not a Windows user. Also see
http://www.imagemagick.org/Usage/api/