Creating cover flow similar to iphone using trapezoid distor

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?".
Post Reply
ranabasheer

Creating cover flow similar to iphone using trapezoid distor

Post by ranabasheer »

I am trying to create a cover flow from multiple images as seen in iphones. I have a screenshot of the iphone cover flow below.
Image

The three covers to the left and the two on the right has some sort of trapezoid distortion. I tried several methods as described in the following tutorial http://www.imagemagick.org/Usage/distor ... rapezoidal but I could not make it work as in iphone. I would appreciate if anybody can help me create those distortions from an image.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Creating cover flow similar to iphone using trapezoid distor

Post by Bonzo »

There was a post about this a month or so ago but it was lost. What you want is not easy and would need some testing but this will get you started.
Image
Image

Code: Select all

<?php
exec("convert src.jpg -resize 640x480 -rotate 270 -bordercolor white -border 10x10 src_border2.bmp");
exec("convert map_p_trapezoidal1.png -resize 500!x660! temp_mask2.png");
exec("convert -size 660x500 -background white src_border2.bmp temp_mask2.png -fx \"p{v*w,j}\" temp2.bmp ");
exec("convert temp2.bmp -rotate 90 -resize 360!x240! after2.jpg");
unlink("src_border2.bmp");
unlink("temp_mask2.png");
unlink("temp2.bmp");
?>
ranabasheer

Re: Creating cover flow similar to iphone using trapezoid distor

Post by ranabasheer »

Following link http://www.imagemagick.org/Usage/distorts/#distort talks about using the -distort perspective option to create the effect but it requires ImageMagic 6.3.5-1. The latest beta version in ftp://ftp.imagemagick.org/pub/ImageMagick/beta/ is only 6.3.5-0. Any idea about the availability of version 6.3.5-1?

I will try to install 6.3.5-0 and check if the -distort option is available in that release.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Creating cover flow similar to iphone using trapezoid distor

Post by anthony »

It is due out friday. Though some bugs in the new multi-processor threading code may delay it slightly.

First the distortion isn't trapesiodal or bilinear which preserves the horizontal scale for that type of X axis symetric distortion. What you see is a true perspective distortion, and that is now present and working in the beta sources (see link above).

WARNING: Until super-sampling comes in sever perspective distortion like what is shown on the iphone, may result in pixelation and aliasing problems.

With the new -distort function we can now look at getting some type of adaptive supersampling, that allows better results.

In rthe mean time there are TWO methods (which I'll write up) that can be used to dif this. First is to enlarge the image first distort then shrink. The other and faster way is to do the perspective distort but leave the right edge at the very right edge of the resulting image. You can then use a non-aspect-preserving -resize to compress the image to the thin size you see.

Code: Select all

  convert image.png  -resize 100x100 \
       -distort Perspective '0,0 0,100 100,0 100,100   0,0 0,100 100,20 100,80' \
       -resize 100x20\!     image_perspective.png
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply