Page 1 of 2

Background Image For Page Curl

Posted: 2011-06-28T14:19:58-07:00
by benbluetoad
I am using the page curl script and need to have an image be the background behind the image curl in the lower right corner. I can change the background color, but do not see how I would use an image for the background. Any help would be much appreciated.

http://www.imagemagick.org/Usage/scripts/pagecurl

Re: Background Image For Page Curl

Posted: 2011-06-28T14:30:28-07:00
by Bonzo
I would guess you need to use a background colour of none and it will be transparent. You would then need to compose the image with the curl over your background image and it will show through.

Re: Background Image For Page Curl

Posted: 2011-06-28T19:35:05-07:00
by benbluetoad
The issue Is trying to accomplish everything from command line. I ultimately want an animated page curl gif. I guess could create all the states with transparency, apply the image background to all, then create the animated gif.

Re: Background Image For Page Curl

Posted: 2011-06-28T21:08:53-07:00
by anthony
Examples of adding a background to mutliple images is exampled in IM examples, Animation Modifications, Composition
http://www.imagemagick.org/Usage/anim_mods/#compose
and specifically adding a Static Background
http://www.imagemagick.org/Usage/anim_mods/#background

I recommend you also apply a find -layers Optimize to reduce the size of the page curve overlay animation.

Be sure to publish an example of the results, preferably with the steps you took to create it.

Hmmm a 'page curl' would make a nice 'replace image' animation.

Re: Background Image For Page Curl

Posted: 2011-06-30T13:49:18-07:00
by fmw42
Animation script courtesy of Anthony Thyssen that I modified slightly.

Code: Select all

image="mandril3.png"
width=`identify -format '%[fx:w]' "$image"`
height=`identify -format '%[fx:h]' "$image"`
start=$((width+height/2))
start1=$((start-start/20))
for ((i=$start1; i>=0; i=i-$((start/20)))); do
  x=$i; y=$((i-width))
  echo >&2 i=$i x=$x y=$y
  pagecurl -x $x -y $y "$image" pam:
done | convert \
   -dispose background \
   -delay 100 "$image" \
   -delay 10 - \
   \( -clone -2-1 \) \
   -delay 100 "$image" \
   -loop 0  \
   -draw 'image DstOver 0,0 0,0 "zelda1.jpg"' \
   -layers Optimize \
   pagecurl_animation3.gif

Image

Re: Background Image For Page Curl

Posted: 2011-06-30T17:48:51-07:00
by anthony
The

Code: Select all

-draw 'image DstOver 0,0 0,0 "zelda1.jpg"'
can be replace by the more modern multi-image layers composition

Code: Select all

null: zelda1.jpg -compose DstOver -layers Composition
Or if you like you can swap the order so non-animation image meta-data (like labels and comments) come from the new 'background' image (the destination image) using the normal 'Over' compostion...

Code: Select all

null: +insert zelda1.jpg +insert -layers Composition
The 'insert' operator places the last image at the start of the sequence
http://www.imagemagick.org/Usage/basics/#insert

Re: Background Image For Page Curl

Posted: 2011-07-06T13:57:08-07:00
by fmw42
Anthony is not available for a few days and wrote me to ask that I correct his previous comment.

Rather than:

-layers Composition

It should be:

-layer Composite


Fred

Re: Background Image For Page Curl

Posted: 2011-07-20T07:56:04-07:00
by benbluetoad
I am still having difficulties using these scripts. I am trying to adjust the amounts as I do not want that much curl. I currently use flash to output the gif (see example) and want to create the same using imagemagick:

http://d27vj430nutdmd.cloudfront.net/pd ... entest.gif

Re: Background Image For Page Curl

Posted: 2011-07-20T09:34:04-07:00
by fmw42
My pagecurl script has a different algorithm that in your link and so you will not be able match the two. A different algorithm would need to be implemented. But I don't know their algorithm. Do you have any references to the algorithm or code?

Re: Background Image For Page Curl

Posted: 2011-07-20T16:11:14-07:00
by anthony
benbluetoad wrote:I am still having difficulties using these scripts. I am trying to adjust the amounts as I do not want that much curl. I currently use flash to output the gif (see example) and want to create the same using imagemagick:

http://d27vj430nutdmd.cloudfront.net/pd ... entest.gif
You never actually mentioned if you want a animation or just a small curl. With a background image I figured it was an animation sequence to replace background..

A small page curl can be done by setting the x,y location of the apex down the right edge.

Or do you mean you just want the page to 'lift' a little, rather that curl over a full cone?

One completely different technique is using draws of spline curves with some gradient fills to add a 'odd-looking' though unrealistic curl.
http://www.myjanee.com/tuts/curled/curled.htm
This has not been converted into a ImageMagick script or example, but should be possible, perhaps using the 'curve effects' you get using the bilinear_reverse distort to generate a curl gradient overlay similar to what they add in the above (but using a different method. I have not tried this, but it would be an interesting curl alternative.

Note the above also shows other methods of adding shades and shadow effects to an image that has not been exampled in IM as yet.

If anyone else has some other page curl technique links. Lets show them. This is a good discussion for it.

Re: Background Image For Page Curl

Posted: 2011-07-21T07:11:21-07:00
by benbluetoad
I want the curl animation like in my previous example. Just the "lift" in the lower right corner as you mention.

Re: Background Image For Page Curl

Posted: 2011-07-21T09:38:52-07:00
by fmw42
I will look into Anthony's idea about using splines to draw the curves for the curl. If successful, I will write a new pagecurl script. But I cannot say how long this might take or when I could finish it. If successful, I will post it back here.

Re: Background Image For Page Curl

Posted: 2011-07-21T09:55:22-07:00
by benbluetoad
Thanks Fred! Your help along with Anthony's has been amazing!

Re: Background Image For Page Curl

Posted: 2011-07-23T11:24:37-07:00
by fmw42
I am looking into a new pagepeel script as suggested above. I have some ideas that I need to test out.

In the mean time, I have added an option to the current pagecurl for a background image.

Re: Background Image For Page Curl

Posted: 2011-07-28T16:17:58-07:00
by fmw42
I have just uploaded a new script, pagepeel, to do the requested effect. See my scripts link below. Here is an example animation.

Image