I'm cropping animated GIFs and the result of some of them is incorrect. Everything I've found says that setting the Page should fix it but it doesn't.
Source Image:
Result Image: (Note the extra transparent area)
I've tried:
- setImagePage before coalesceImages
- setImagePage after deconstructImages
- using the setPage function
- Saving the image, loading it again and recropping it (does nothing)
- doing setImagePage(0, 0, 0, 0)
- doing setImagePage(null, null, null, null)
Notes:
- If I also resize the result smaller, things work fine.
- ImageMagick claims the resulting image is the right size.
Details:
Example: http://mafiareturns.com/admin/matt_stuf ... k/crop.php
Source: http://pastebin.com/J02KqTrw
ImageMagick Version: ImageMagick 6.7.5-3 2012-02-24 Q16 http://www.imagemagick.org
PHP Extension Version (Gentoo package): dev-php/pecl-imagick version 3.0.0-r1
OS: Gentoo
Edit://Oops.
Animated gif, setImagePage incorrect after crop
-
- Posts: 3
- Joined: 2012-02-27T17:01:07-07:00
- Authentication code: 8675308
-
- Posts: 3
- Joined: 2012-02-27T17:01:07-07:00
- Authentication code: 8675308
Re: Animated gif, setImagePage incorrect after crop
I did some testing with the command line tools which I had never used before and was able to get a good image as well as duplicate the results that Imagick is creating.
This one works fine, creates the desired results:
This one creates an animated gif with extra transparent area on the right and bottom sides:
I used the same file in the example in the last post.
This one works fine, creates the desired results:
Code: Select all
convert haters-owl.gif -coalesce -crop 100x100+25+25\! console_test.gif
Code: Select all
convert haters-owl.gif -coalesce -crop 100x100+25+25\! -layers OptimizePlus console_test.gif
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Animated gif, setImagePage incorrect after crop
this sounds similar to the problem reported at viewtopic.php?f=1&t=20227&p=80411&hilit ... ize#p80392. See the whole set of replies, esp, from Anthony. You may need to upgrade your IM version.
Re: Animated gif, setImagePage incorrect after crop
Try setimagepage().
Dimensions 240 x 92
Size 135691 bytes
Number Of Colors 79
Format GIF
Frames 25
Working cropper
http://eclecticdjs.com/mike/wtv/tools/i ... rop_03.php
Source
http://eclecticdjs.com/mike/wtv/tools/i ... rop_03.txt
Needs these to upload and some functions:
http://eclecticdjs.com/mike/wtv/tools/i ... ctions.txt
http://eclecticdjs.com/mike/wtv/tools/i ... upload.txt
Relevent code:
Dimensions 240 x 92
Size 135691 bytes
Number Of Colors 79
Format GIF
Frames 25
Working cropper
http://eclecticdjs.com/mike/wtv/tools/i ... rop_03.php
Source
http://eclecticdjs.com/mike/wtv/tools/i ... rop_03.txt
Needs these to upload and some functions:
http://eclecticdjs.com/mike/wtv/tools/i ... ctions.txt
http://eclecticdjs.com/mike/wtv/tools/i ... upload.txt
Relevent code:
Code: Select all
$image = new Imagick($_SESSION[path]);
##################
if ( $_GET[action] == "Crop" )
{
foreach ($image as $frame)
{ $frame->cropimage( $w, $h, $ul_x, $ul_y); }
}
##################
# Reset geometry
foreach ($image as $frame)
{ $frame->setimagepage( $w, $h, 0, 0); }
DJ Mike's Tutorials: PHP
ImageMagick Functions
http://eclecticdjs.com/mike/tutorials/p ... /index.php
ImageMagick Functions
http://eclecticdjs.com/mike/tutorials/p ... /index.php
-
- Posts: 3
- Joined: 2012-02-27T17:01:07-07:00
- Authentication code: 8675308
Re: Animated gif, setImagePage incorrect after crop
I use setImagePage, and have tried it everywhere. As I have it now, it does do what its supposed to MOST of the time.