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?".
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 »

But I have another issue, my background is always blank and not transparent, I forgot something ??
Your command is rather complex to understand, but in general to enable an image to be transparent you need to add -channel rgba -matte. I see the -matte, but not the -channel rgba and don't see either after your first image before the -virtual-pixel transparent.
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 »

Before the -layers merge add -background {color} with the color you want for the background.

the overlay compose can also be added to the same command by adding before the final save filename

Code: Select all

layer.jpg -compose HardLight -composite
This assumes the two images line up, with the right size and/or positions.

Note HardLight is exactly the same as Overlay except the source and destination images are swapped.

PS: the overlay image can also include soft shadows too.

I would still like to know how you generated your overlay image.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Morphleus

Re: convert a picture to a 3D DVD cover

Post by Morphleus »

anthony you are my hero !!!
I have exactly what I'm looking for... It's been a long time (many years) I tried to do that. I explored a lot of solutions but nothing capable to do that.
Thanks a lot !!!

edit: in fact not, my backgroup is now grey :( :( :(

Code: Select all

exec ("convert layoutwm3.png -virtual-pixel transparent \( back.jpg -matte +distort Perspective '0,0 62,79   0,1057 62,899   739,1057 625,910   739,0 625,63' \) \( spine.jpg -matte +distort Perspective '0,0 625,37  0,1057 625,920  81,1057 680,935    81,0 680,31' \) \( front.jpg -matte +distort Perspective '0,0 680,31     0,1057 680,935    758,1057 1229,884   758,0 1229,77' \) -background transparent -layers merge +repage layer.jpg -compose HardLight -composite img.png");
I tried background transparent and none, but nothing is working. If I usea colot it works but I want a transparent backgroup.[/color]
I would still like to know how you generated your overlay image.
I did it with photoshop
Looks great... pretty damn impressive that you could pull that off with only two commands. What adds the black border?
I did a black layer with photoshop.

I have another question...
I would like to make transparent the background of my labels.
Is it possible to make transparent a part of an image, for me, I need to make transparent the center and the ouside on my CD.
I found many ways to do that to one color on the forum but not in a zone, maybe with a particular layer ??
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 »

Morphleus wrote:edit: in fact not, my backgroup is now grey :( :( :(


Make the -background color just before the -layers merge, say white! to remove the transparency at that point.

The fact that Hardlight (and Overlay) composition method do not retain the transparency has to my thinking always been a BUG. I have not however checked the SVG documentation which defines the action of these composition methods.

Also not that a related composition SoftLight, is still broken, but is a very complex method and so far not been fixed without someone spending some time on that problem.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
vibez

Re: convert a picture to a 3D DVD cover

Post by vibez »

Hi,

I really love your idea for creating 3d covers in imagemagick.

I have tried to copy your code but unfortunately the result looks nothing like the example you posted. Is there any chance you could share your working commands for the sample image?
moutonzare

Re: convert a picture to a 3D DVD cover

Post by moutonzare »

Hi, sorry for the bump.

I work on this with Morpleus and at least we find a solution:

Code: Select all

convert \( \( -size 1329x1026 xc:black -virtual-pixel Transparent \
        \( \( cover.jpg -resize 1600x1074\! -gravity East -chop 860x0 \) \
                        -matte +distort Perspective '0,0 62,80   0,1073 62,898   739,1073 625,910   739,0 625,63' \) \
        \( \( cover.jpg -resize 1600x1074\! -gravity East -chop 758x0  -gravity West -chop 758x0 \) \
                        -matte +distort Perspective '0,0 625,38  0,1073 625,920  81,1073 680,935    81,0 680,32' \) \
        \( \( cover.jpg -resize 1600x1074\! -gravity West -chop 841x0 \) \
                        -matte +distort Perspective '0,0 680,32     0,1073 680,935    758,1073 1228,883   758,0 1228,78' \) \
        -layers merge +repage layer.jpg -compose HardLight -composite \) \
        -alpha Off opacity.jpg -compose CopyOpacity -composite \) \
        -resize 420x324 preview.png
layer.jpg:
Image
opacity.jpg:
Image


It work fine for now but we want to do something else. I want to do that:
Image

Code: Select all

convert \( \( -size 1700x1026 xc:black -virtual-pixel Transparent \
        \( \( cover.png -resize 1600x1074\! -gravity East -chop 860x0 \) \
                        -matte +distort Perspective '0,0 62,80   0,1073 62,898   739,1073 628,912   739,0 628,64' \) \
        \( \( cover.png -resize 1600x1074\! -gravity East -chop 758x0  -gravity West -chop 758x0 \) \
                        -matte +distort Perspective '0,0 628,38  0,1073 628,922  81,1073 688,937    81,0 688,31' \) \
        \( \( cover.png -resize 1600x1074\! -gravity West -chop 841x0 \) \
                        -matte +distort Perspective '0,0 688,31     0,1073 688,937    758,1073 1228,884   758,0 1228,79' \) \
        \( \( label.png -resize 510x510\! -gravity West -chop 100x0 \) \
                        +distort Perspective '0,0 1232,229   0,509 1232,738   409,509 1641,738   409,0 1641,229' \) \
        -layers merge +repage imandix_label_layer.jpg -compose HardLight -composite \) \
        -alpha Off imandix_label_opacity.jpg -compose Copy_Opacity -composite \) \
        -resize 420x253 preview.png
imandix_label_layer.jpg:
Image
imandix_label_opacity.jpg
Image
cover.png:
Image
label.png:
Image

It works fine with a label in png that is already cut around the edge. If I use a png without that or a jpg then I have to use a mask.

Code: Select all

convert \( \( -size 1700x1026 xc:black -virtual-pixel Transparent \
        \( \( cover.png -resize 1600x1074\! -gravity East -chop 860x0 \) \
                        -matte +distort Perspective '0,0 62,80   0,1073 62,898   739,1073 628,912   739,0 628,64' \) \
        \( \( cover.png -resize 1600x1074\! -gravity East -chop 758x0  -gravity West -chop 758x0 \) \
                        -matte +distort Perspective '0,0 628,38  0,1073 628,922  81,1073 688,937    81,0 688,31' \) \
        \( \( cover.png -resize 1600x1074\! -gravity West -chop 841x0 \) \
                        -matte +distort Perspective '0,0 688,31     0,1073 688,937    758,1073 1228,884   758,0 1228,79' \) \
        \( \( \( \( label.jpg -resize 510x510\! \) -alpha Off label_mask_2.jpg -compose Copy_Opacity -composite \) \
                                                   -gravity West -chop 100x0 \) \
                                                   -matte +distort Perspective '0,0 1232,229   0,509 1232,738   409,509 1641,738   409,0 1641,229' \) \
        -layers merge +repage .imandix_label_layer.jpg -compose HardLight -composite \) \
        -alpha Off imandix_label_opacity.jpg -compose Copy_Opacity -composite \) \
        -resize 420x253 preview.png
label_mask_2.jpg:
Image
label.jpg:
Image

And it doesn't work. I get that instead:
Image

Anyone have an idea ?
Last edited by moutonzare on 2009-04-08T05:02:14-07:00, edited 2 times in total.
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 »

vibez wrote:Hi,

I really love your idea for creating 3d covers in imagemagick.

I have tried to copy your code but unfortunately the result looks nothing like the example you posted. Is there any chance you could share your working commands for the sample image?
Anthony's example is at http://www.imagemagick.org/Usage/distorts/#box3d

Perhaps my script will help you. See 3Dbox script at http://www.fmwconcepts.com/imagemagick/index.html
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 »

Fantastic work!!!! This is a great example of making use of layered images.
I like the way you shade the spine so that it has a curved look, even though the prespective distortion makes it angular :-)


As to you problem: The only difference that should exist between a PNG and a JPG is that JPG's do not have transparency.

You should not need to go though all the convolutions you do for your last attempt specifically for handling JPG images. Just adding -matte or -alpha set (same thing) should be enough to take care of the differences.

I gather the -resize in the above is needed because you can not be certain the input images are always a known size. Otherwise I wouldn't resize the images at all.

Why are you using perspective for the disk 'label' image? If the result is a disk than a simple -resize and -repage will position the image, as a image layer where you want it, and can mask it
before the final merger.

Finally rather than using two chops, you can use -crop with either a '!' or a +repage to remove the layer offset the crop leaves behind.

Warning: you are relying on the transparency color being black when you add the opacity mask. This is OK, but it is a side effect of the math. I would suggest you instead flatten the image onto black (or whatever shadow color you want) before the -alpha Off in preparation for opacity masking.

ASIDE: may I include a copy of the image your first example generates in IM examples? I will not include the actual commands used (that is yours), just give a text description of the processes used instead.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
moutonzare

Re: convert a picture to a 3D DVD cover

Post by moutonzare »

I change the double chop to a single crop and use repage instead of changing the perspective. I used perspective because first I tried to use page but it doesn't work.

Code: Select all

convert \( \( -size 1700x1026 xc:black -virtual-pixel Transparent \
        \( \( cover.png -resize 1600x1074\! -gravity East -chop 860x0 \) \
                        -matte +distort Perspective '0,0 62,80   0,1073 62,898   739,1073 628,912   739,0 628,64' \) \
        \( \( cover.png -resize 1600x1074\! -crop 84x0+758+0\! \) \
                        -matte +distort Perspective '0,0 628,38  0,1073 628,922  81,1073 688,937    81,0 688,31' \) \
        \( \( cover.png -resize 1600x1074\! -gravity West -chop 841x0 \) \
                        -matte +distort Perspective '0,0 688,31     0,1073 688,937    758,1073 1228,884   758,0 1228,79' \) \
        \( label.jpg -resize 510x510\! -repage +1532+229 -gravity West -chop 100x0 \)  \
        -layers merge +repage imandix_label_layer.jpg -compose HardLight -composite \) \
        -alpha Off imandix_label_opacity.jpg -compose Copy_Opacity -composite \) \
        -resize 420x253 preview.png
for the -resize I cannot be certain about the size of the input images. Maybe I can dynamically fill the number of the Perspective (I use this in a php script) with the height and width of the input image.

Well for the difference between PNG and JPG, I know JPG doesn't have an alpha channel but that's not the problem. If the input label image isn't already masked if it's a PNG then I have a problem:
Image

That's why I tried to apply a mask on the label before merge, hardlight and copy_opacity but like I said, it didn't work. I also tried with Dst_In instead of Copy_Opacity (and with -matte where it matters) and it didn't work too.

Code: Select all

convert \( \( -size 1700x1026 xc:black -virtual-pixel Transparent \
        \( \( cover.png -resize 1600x1074\! -gravity East -chop 860x0 \) \
                        -matte +distort Perspective '0,0 62,80   0,1073 62,898   739,1073 628,912   739,0 628,64' \) \
        \( \( cover.png -resize 1600x1074\! -crop 84x0+758+0\! \) \
                        -matte +distort Perspective '0,0 628,38  0,1073 628,922  81,1073 688,937    81,0 688,31' \) \
        \( \( cover.png -resize 1600x1074\! -gravity West -chop 841x0 \) \
                        -matte +distort Perspective '0,0 688,31     0,1073 688,937    758,1073 1228,884   758,0 1228,79' \) \
        \( \( label.jpg -resize 510x510\! -alpha Off ./label_mask_2.jpg -compose Copy_Opacity -composite \) \
                        -repage +1532+229 -gravity West -chop 100x0 \)  \
        -layers merge +repage imandix_label_layer.jpg -compose HardLight -composite \) \
        -alpha Off imandix_label_opacity.jpg -compose Copy_Opacity -composite \) \
        -resize 420x253 preview.png
Image

Code: Select all

convert \( \( -size 1700x1026 xc:black -virtual-pixel Transparent \
        \( \( cover.png -resize 1600x1074\! -gravity East -chop 860x0 \) \
                        -matte +distort Perspective '0,0 62,80   0,1073 62,898   739,1073 628,912   739,0 628,64' \) \
        \( \( cover.png -resize 1600x1074\! -crop 84x0+758+0\! \) \
                        -matte +distort Perspective '0,0 628,38  0,1073 628,922  81,1073 688,937    81,0 688,31' \) \
        \( \( cover.png -resize 1600x1074\! -gravity West -chop 841x0 \) \
                        -matte +distort Perspective '0,0 688,31     0,1073 688,937    758,1073 1228,884   758,0 1228,79' \) \
        \( \( label.jpg -resize 510x510\! -matte ./labelRef.png -compose Dst_In -composite \) \
                        -repage +1532+229 -gravity West -chop 100x0 \)  \
        -layers merge +repage imandix_label_layer.jpg -compose HardLight -composite \) \
        -matte imandix_label_opacity_2.png -compose Dst_In -composite \) \
        -resize 420x253 preview.png
Image

Code: Select all

convert \( \( -size 1700x1026 xc:black -virtual-pixel Transparent \
        \( \( cover.png -resize 1600x1074\! -gravity East -chop 860x0 \) \
                        -matte +distort Perspective '0,0 62,80   0,1073 62,898   739,1073 628,912   739,0 628,64' \) \
        \( \( cover.png -resize 1600x1074\! -crop 84x0+758+0\! \) \
                        -matte +distort Perspective '0,0 628,38  0,1073 628,922  81,1073 688,937    81,0 688,31' \) \
        \( \( cover.png -resize 1600x1074\! -gravity West -chop 841x0 \) \
                        -matte +distort Perspective '0,0 688,31     0,1073 688,937    758,1073 1228,884   758,0 1228,79' \) \
        \( \( label.jpg -resize 510x510\! -alpha Off ./label_mask_2.jpg -compose Copy_Opacity -composite \) \
                        -repage +1532+229 -gravity West -chop 100x0 \)  \
        -layers merge +repage imandix_label_layer.jpg -compose HardLight -composite \) \
        -matte imandix_label_opacity_2.png -compose Dst_In -composite \) \
        -resize 420x253 preview.png
Image

Code: Select all

convert \( \( -size 1700x1026 xc:black -virtual-pixel Transparent \
        \( \( cover.png -resize 1600x1074\! -gravity East -chop 860x0 \) \
                        -matte +distort Perspective '0,0 62,80   0,1073 62,898   739,1073 628,912   739,0 628,64' \) \
        \( \( cover.png -resize 1600x1074\! -crop 84x0+758+0\! \) \
                        -matte +distort Perspective '0,0 628,38  0,1073 628,922  81,1073 688,937    81,0 688,31' \) \
        \( \( cover.png -resize 1600x1074\! -gravity West -chop 841x0 \) \
                        -matte +distort Perspective '0,0 688,31     0,1073 688,937    758,1073 1228,884   758,0 1228,79' \) \
        \( \( label.jpg -resize 510x510\! -matte ./labelRef.png -compose Dst_In -composite \) \
                        -repage +1532+229 -gravity West -chop 100x0 \)  \
        -layers merge +repage imandix_label_layer.jpg -compose HardLight -composite \) \
        -alpha Off imandix_label_opacity.jpg -compose Copy_Opacity -composite \) \
        -resize 420x253 preview.png
Image

labelRef.png:
Image
imandix_label_opacity_2.png:
Image

I think miss something but I don't see what ^^'

For the black thing, I think it's ok since i use that "-size 1700x1026 xc:black". When I merge the layer before the hardlight the backgound is black. hardLight leave it alone and then CopyOpacity does its work. Actually, the -alpha Off is not mandatory after the hardlight since hardlight is still broken I think and doesn't retain the transparency. I'm wrong ?

ASIDE: Feel free to use any of the images. I post them so it can be useful to others ^^
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 »

Before continuing I think I better mention a thing I learned about coordinate handling in IM distorts.

Coordinates for distort are in image coordinates. This is only important when you consider that pixels actually have a dimension. that means the location of pixel 0,0 is at image coordinates 0.5,0.5 ! think about it.

as such when distorting images the edges are located at 0,0 and Width,Height. the pixels however are at 0.5,0.5 and Widith-0.5,Height-0,5.

This is just something to think about when trying to match up distorted images in IM. I still have to go though my examples to check if they are matching up the right coordinates.

This may be the source of your original problem, and you may get a better solution adding 0.5 to your coordinates. Of course as you are overlaying a Hardlight shading effects, that could be used to cover up any inaccuracies.

This thinking has not resulted in any change to Affine and Perspective distorts, but distorts relying on a 'image center' has been corrected to match the real 'image center' and not a 'center pixel'.

WARNING: while distort uses "image coordinates", other operators in IM such as -draw, -crop, etc etc etc will of course continue to use "pixel coordinates" simply because it makes more sense in those operations. As such when trying to match up -draw's with -distorts you need to adjust coordinates appropriately.

This has been added to IM Examples, Distorts page Image Coordinates vs Pixel Coordinates, and will be on the official site in a few days.

As to your problems, More to come....
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
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 »

your problem.....

You used -compose Copy_Opacity, but then later you use -layers merge which also uses the -compose setting. As such it repeat ly resets the alpha change rather than layering the images as you are wanting!

Reset the setting back to -compose Over before -layers merge ;-)

I checked it ad it does work...


Stay tuned for some extra suggestions....
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
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 »

Some extra suggestions...
  • Don't re-read the image over and over. Read it once.

    By only reading an image once you get some speed improvement as IM does nto have to decode it mutiple times.
    It also means later you can pipe the INPUT images into the command rather than reading it from a file
  • Why the need for all the extra parenthesis.

    Make use of +swap +delete and +insert to add images to the image sequence in the appropriate locations.

    This simplify the command and makes it easier to read, understand and debug.
  • Also if you order your images you can have one image Obscure a previous image layer. That means by loading and handlign the 'disk' image first. you don't need to crop it, just overlay the distorted cover images on top of it. Should make handling the 'back' cover easier too, as the spine can overlay on top of it, and you can deal with that image as a whole.

    Of course repositioning things at this point may be difficult, so it may be better to leave it alone. But for a new 3D box work, ordering your images from back to front can make it a lot easier!
here is my version of your first example. Only one level of parenthesis is used. The image only read in once, and the original later replaced by a 'black' background canvas. and most major operations are self contained by parenthesis or a single line. Easy to follow and debug.

Code: Select all

convert -virtual-pixel Transparent -background Transparent \
        cover.png -alpha set -resize 1600x1074\! \
        \( -clone 0 -crop 740x0+0+0\! +distort Perspective \
             '0,0 62,80 0,1073 62,898   739,1073 625,910   739,0 625,63' \
        \) \
        \( -clone 0 -crop 84x0+758+0\! +distort Perspective \
             '0,0 625,38  0,1073 625,920  81,1073 680,935  81,0 680,32' \
        \) \
        \( -clone 0 -crop 759x0+841+0\! +distort Perspective \
             '0,0 680,32 0,1073 680,935  758,1073 1228,883  758,0 1228,78' \
        \) \
        -size 1329x1026 xc:black -swap 0 +delete \
        -layers merge +repage \
        layer.jpg -compose HardLight -composite \
        opacity.jpg -alpha off -compose CopyOpacity -composite \
        -resize 420x324  preview.png
I leave it to you to update your other 'disk' version.

If "cover.png" is replaced by '-' you can 'pipe' an image in (JPEG or otherwise) without needing to save it to a file first.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
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 »

The resulting image and pointers to this forum discussion has been added to IM Examples, 3D Perspective Box.

It should appear in a few days.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
moutonzare

Re: convert a picture to a 3D DVD cover

Post by moutonzare »

Thank you for all this tips ^^ The -compose Over really works well. I tried to apply the '+0.5' for the +distort but it give me some gap problems so I leave it alone since it works fine without it. I make use of -clone and -delete. It's quite effective to not read the image a few time. I don't really need to put the 'disk' image first because the black border come from xc:black and the Copy_Opacity. Also I remove all the useless parenthesis. I don't quite get when you need to put a parenthesis but, well, it works ^^ So here the (final ?) commands for a single cover or a cover and a label.

cover.png:
Image
cover_light.png:
Image
cover_opacity.png:
Image

Code: Select all

convert -size 1330x1026 xc:black -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' \
           \) \
           -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 preview.png
Image

label.jpg:
Image
cover_label_light.png:
Image
cover_label_opacity.png:
Image
lalbe_opacity.png:
Image

Code: Select all

convert -size 1700x1026 xc:black -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' \
           \) \
           -delete 0 \
        \) \
        \( label.jpg -resize 510x510\! label_opacity.png -alpha Off -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 Off -compose Copy_Opacity -composite \
        -resize 420x253\! -quality 95 -depth 8 preview.png
Image

It's pretty much ok now. I will post again if I do other things like preview for two or more covers and labels ^^ Thank you again for your guidance. Feel free to give me other tips ;)

edit: change the first crop from 758x0+0+0 to 740x0+0+0 for both the command and add -quality 95 -depth 8 at the end of both.
Last edited by moutonzare on 2009-04-10T01:50:24-07:00, edited 2 times in total.
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 »

moutonzare wrote:Also I remove all the useless parenthesis. I don't quite get when you need to put a parenthesis but, well, it works
All the parenthesis does is start a separate 'list' or 'sequence' of images, so you can work on them without interfering with images you previously were working on. When the parenthesis end, any images in that list are appended to the previous list of images you were working on before the start of the parenthesis.

NOTE: in my version, the following line...

Code: Select all

              -size 1329x1026 xc:black -swap 0 +delete \ 
This creates the 'black' canvas AFTER all the distort processing was done. It then 'swaps' this black image, with the original image that was being cloned, so it is now at the start of the image sequence. The original image is then deleted.

At the start of the line the image sequence in memory is

original_cover, front, spine, back

At the end of the line it is

black_canvas, front, spine, back

Ready for the -layer operator to merge them all together.

ANY of the layer operators, 'Merge', 'Mosaic', or 'Flatten' can be used for this layer merging, as the first image is large enough to whole all the images. 'Merge' however is probably best as it make it clear that is what you are doing.

After merging you only have one image at the start of each line, your read in a new image, and composite that new image into the result to again leave one image.

Getting back to parenthesis...

The \( Saves the current images in memory putting them out of the way (only -clone can get at them)

The \) then appends the new images onto the previously saved image sequence, and restores that sequence.

That is all they do, but it allows you to work on just one or two images, without effecting images you have already finished working on.

The -swap -insert -delete operators lets you re-arrange the images in memory.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply