convert a picture to a 3D DVD cover

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?".
Morphleus
Posts: 6
Joined: 2012-04-09T08:06:04-07:00
Authentication code: 8675308

Re: convert a picture to a 3D DVD cover

Post by Morphleus »

Hi everybody,

I'm coming back because I have an issue since I change my dedicated server and my version of ImageMagick.

Before everything was good with that script

Code: Select all

convert -size 1330x1026 xc:black -virtual-pixel Transparent \
	\( fr.jpg -matte -resize 1600x1074\! \
	\( -clone 0 -crop 758x0+0+0\! \
	+distort Perspective '0,0  62,80  0,1073  62,897  739,1073  628,912  739,0  628,64' \) \
	\( -clone 0 -crop 84x0+758+0\! \
	+distort Perspective '0,0 628,38  0,1073 628,922   83,1073  688,937   83,0  688,30' \) \
	\( -clone 0 -crop 758x0+842+0\! \
	+distort Perspective '0,0 688,30  0,1073 688,937  757,1073 1228,883  757,0 1228,80' \) \
	-delete 0 \) \
	-layers merge \
	cover_light.png -compose HardLight -composite \
	cover_opacity.png -alpha Off -compose Copy_Opacity -composite \
	-resize 420x324\! -quality 95 -depth 8 test.png
you can see the result here
before with ImageMagick 6.4.2 07/07/08
Image

now with ImageMagick 6.6.0-4 2012-03-05
Image

How can I do to solve that ?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert a picture to a 3D DVD cover

Post by fmw42 »

I don't see any obvious difference. What do you see that is wrong?
Morphleus
Posts: 6
Joined: 2012-04-09T08:06:04-07:00
Authentication code: 8675308

Re: convert a picture to a 3D DVD cover

Post by Morphleus »

It will be easier with giant pics
before
http://imageup.fr/uploads/1334002585.png

after
http://imageup.fr/uploads/1334002676.png

you can see that there are problems at the bottom of the pictures, borders are not black around and colors are brigther.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert a picture to a 3D DVD cover

Post by fmw42 »

Your distort perspective probably needs to have -virtual-pixel set to black or transparent. It seems to be getting edge. Can you post a link to your input image, so that we can test your code with it?
Morphleus
Posts: 6
Joined: 2012-04-09T08:06:04-07:00
Authentication code: 8675308

Re: convert a picture to a 3D DVD cover

Post by Morphleus »

You can download that
http://dl.free.fr/jog38TA5x
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert a picture to a 3D DVD cover

Post by fmw42 »

This works perfectly fine form me under IM 6.7.6.5 Q16 Mac OSX Snow Leopard. Perhaps it is a version problem. Try upgrading and test again.

Note I removed the last resize to get the full resolution image.

convert -size 1330x1026 xc:black -virtual-pixel Transparent \
\( fr.jpg -matte -resize 1600x1074\! \
\( -clone 0 -crop 758x0+0+0\! \
+distort Perspective '0,0 62,80 0,1073 62,897 739,1073 628,912 739,0 628,64' \) \
\( -clone 0 -crop 84x0+758+0\! \
+distort Perspective '0,0 628,38 0,1073 628,922 83,1073 688,937 83,0 688,30' \) \
\( -clone 0 -crop 758x0+842+0\! \
+distort Perspective '0,0 688,30 0,1073 688,937 757,1073 1228,883 757,0 1228,80' \) \
-delete 0 \) \
-layers merge \
cover_light.png -compose HardLight -composite \
cover_opacity.png -alpha Off -compose Copy_Opacity -composite \
-quality 95 -depth 8 test.png
Morphleus
Posts: 6
Joined: 2012-04-09T08:06:04-07:00
Authentication code: 8675308

Re: convert a picture to a 3D DVD cover

Post by Morphleus »

I have just installed the last version ImageMagick 6.7.6-5 2012-04-10 Q16. I have another problem right now... When I launched the command I have this error

Code: Select all

convert: no decode delegate for this image format `fr.jpg' @ error/constitute.c/ReadImage/533.
convert: image sequence is required `-clone' @ error/convert.c/ConvertImageCommand/927.
When I did the make check there was no error with convert function.

I saw that I need to install delegates. libjpeg seems not exist anymore...
Morphleus
Posts: 6
Joined: 2012-04-09T08:06:04-07:00
Authentication code: 8675308

Re: convert a picture to a 3D DVD cover

Post by Morphleus »

Everything seems to be fixed.
I installed delegates and it works. So it was a bug in the previous version.

Thanks guy for your support.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: convert a picture to a 3D DVD cover

Post by anthony »

As an addendum to this topic. You can merge the cover_light.png and cover_opacity.png into a single image.

For details see.. IM Examples, Thumbnails and Framing, Lighting Mask
http://www.imagemagick.org/Usage/thumbn ... hting_mask
and more specifically, exampled in Badge using Lighting effects
http://www.imagemagick.org/Usage/thumbn ... e_lighting

You can even take it further and convert the multiple distorts into distortion/displacement maps.
these can then also be merged so that you use a single 4 channel PNG, image containing
X,Y displacement maps, shading map, and transparency mask
That encapulates the whole process, for any distortion, shading, and transparency you like.

See an example of this in Unified Distortion Maps
http://www.imagemagick.org/Usage/mappin ... on_unified
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Morphleus
Posts: 6
Joined: 2012-04-09T08:06:04-07:00
Authentication code: 8675308

Re: convert a picture to a 3D DVD cover

Post by Morphleus »

anthony wrote:You can even take it further and convert the multiple distorts into distortion/displacement maps.
these can then also be merged so that you use a single 4 channel PNG, image containing
X,Y displacement maps, shading map, and transparency mask
That encapulates the whole process, for any distortion, shading, and transparency you like.

See an example of this in Unified Distortion Maps
http://www.imagemagick.org/Usage/mappin ... on_unified
It's really impressive but it seems very difficult to transform my distortions into gray gradients...

Actually the way to do it is start with two images a X gradient (black left), and a Y gradient (black at top).
distort them as usual but don't do the masking and shading. The results are absolute distortion maps that
then replace the distortions. They can also be converted to relative distortion maps, though really their
is no need.

Note while I have not exampled it (it was added after last worked on the mapping examples page) their is a 'distort' compose method that is similar to that of the 'displace' distortion method. This gets rid of the current slow 'fx' expressions.
gruz
Posts: 3
Joined: 2013-04-05T17:26:36-07:00
Authentication code: 6789

Re: convert a picture to a 3D DVD cover

Post by gruz »

Is there any chance to restore images from this post?
viewtopic.php?f=1&t=11726&start=15#p45644
Please!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert a picture to a 3D DVD cover

Post by fmw42 »

gruz wrote:Is there any chance to restore images from this post?
viewtopic.php?f=1&t=11726&start=15#p45644
Please!

I do not see any missing pictures at the link specified in that topic.
gruz
Posts: 3
Joined: 2013-04-05T17:26:36-07:00
Authentication code: 6789

Re: convert a picture to a 3D DVD cover

Post by gruz »

Please, have a look at how I see the post:
Image
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert a picture to a 3D DVD cover

Post by fmw42 »

You are right. But the OP will have to repost those. They are not hosted on the IM servers.
gruz
Posts: 3
Joined: 2013-04-05T17:26:36-07:00
Authentication code: 6789

Re: convert a picture to a 3D DVD cover

Post by gruz »

So just to restore the manual.

One must have 2 own images and 3 core images (keep untouched). Download them to a folder, rename image files as shown with bold and run the code:

Own images (the ones you have to modify at your own - YOUR cover and YOUR disc image):
cover.png
Image
label.jpg
Image

And three core images:
label_opacity.png
Image

cover_label_light.png
Image

cover_label_opacity.png
Image

And here is the result:
preview.png
Image

Code: Select all

convert -virtual-pixel Transparent \
        cover.png -matte -resize 1600x1074\! \
        \( -clone 0 -crop 740x0+0+0\! \
                    +distort Perspective '0,0  62,80  0,1073  62,897  739,1073  628,912  739,0  628,64' \
        \) \
        \( -clone 0 -crop 84x0+758+0\! \
                    +distort Perspective '0,0 628,38  0,1073 628,922   83,1073  688,937   83,0  688,30' \
        \) \
        \( -clone 0 -crop 758x0+842+0\! \
                    +distort Perspective '0,0 688,30  0,1073 688,937  757,1073 1228,883  757,0 1228,80' \
        \) \
        -size 1700x1026 xc:black -swap 0,-1 +delete \
        \( label.jpg -resize 510x510\! label_opacity.png -alpha On -compose Copy_Opacity -composite \
                     -crop 410x0+100+0\! -repage +1232+229 \
        \) \
        -compose Over -layers merge \
        cover_label_light.png -compose HardLight -composite \
        cover_label_opacity.png -alpha On -compose Copy_Opacity -composite \
        -resize 1260x760\! -quality 95 -depth 8     preview.png
To compare with the code I have taken from this topc, I have had to turn Alpha On, as with Off it was generating something bad.
Post Reply