Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Image::sliceAnimation() #1249

Merged
merged 3 commits into from
Jan 16, 2024
Merged

Conversation

olivervogel
Copy link
Member

@olivervogel olivervogel commented Jan 4, 2024

Slice Animation

public Image::sliceAnimation(int $offset, null|int $length = null): ImageInterface

Extract animation frames based on given values and discard the rest. The offset
parameter can be used to set the starting point of the new animation; all
frames before the offset are discarded. The length parameter is optional. It
specifies how many frames to read after the offset. By default, all frames up
to the end of the animation are read.

Parameters

Name Type Description
offset integer Starting point of the new animation
length null or integer Frames to read after the offset (optional)

Examples

use Intervention\Image\ImageManager;
use Intervention\Image\Drivers\Gd\Driver;

// create new manager instance with desired driver
$manager = new ImageManager(new Driver());

// reading an animated gif
$image = $manager->read('images/animation.gif');

// discard the first 20 frames and read the following 10 frames as new animation
$image = $image->sliceAnimation(20, 10);

@olivervogel olivervogel force-pushed the feature/slice-animation branch from 80af8ce to 296b9a1 Compare January 4, 2024 19:59
@olivervogel olivervogel added this to the Version 3.3.0 milestone Jan 6, 2024
@olivervogel olivervogel merged commit 66efef9 into develop Jan 16, 2024
12 checks passed
@olivervogel olivervogel deleted the feature/slice-animation branch January 20, 2024 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant