Background Image For Page Curl

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?".
benbluetoad
Posts: 5
Joined: 2011-06-28T14:14:29-07:00
Authentication code: 8675308

Background Image For Page Curl

Post 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

Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Background Image For Page Curl

Post 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.

benbluetoad
Posts: 5
Joined: 2011-06-28T14:14:29-07:00
Authentication code: 8675308

Re: Background Image For Page Curl

Post 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.

User avatar
anthony
Posts: 8884
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Background Image For Page Curl

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Background Image For Page Curl

Post 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

User avatar
anthony
Posts: 8884
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Background Image For Page Curl

Post 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
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Background Image For Page Curl

Post 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

benbluetoad
Posts: 5
Joined: 2011-06-28T14:14:29-07:00
Authentication code: 8675308

Re: Background Image For Page Curl

Post 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

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Background Image For Page Curl

Post 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?

User avatar
anthony
Posts: 8884
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Background Image For Page Curl

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

benbluetoad
Posts: 5
Joined: 2011-06-28T14:14:29-07:00
Authentication code: 8675308

Re: Background Image For Page Curl

Post by benbluetoad »

I want the curl animation like in my previous example. Just the "lift" in the lower right corner as you mention.

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Background Image For Page Curl

Post 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.

benbluetoad
Posts: 5
Joined: 2011-06-28T14:14:29-07:00
Authentication code: 8675308

Re: Background Image For Page Curl

Post by benbluetoad »

Thanks Fred! Your help along with Anthony's has been amazing!

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Background Image For Page Curl

Post 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.

User avatar
fmw42
Posts: 26383
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Background Image For Page Curl

Post 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

Locked