{"id":13530412,"url":"https://github.com/Sybio/GifFrameExtractor","last_synced_at":"2025-04-01T18:31:41.071Z","repository":{"id":4771104,"uuid":"5922404","full_name":"Sybio/GifFrameExtractor","owner":"Sybio","description":"GifFrameExtractor is a PHP class that separates all the frames (and their duration) of an animated GIF","archived":false,"fork":false,"pushed_at":"2022-07-23T14:07:50.000Z","size":242,"stargazers_count":177,"open_issues_count":9,"forks_count":60,"subscribers_count":16,"default_branch":"master","last_synced_at":"2024-10-29T20:26:08.750Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Sybio.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-09-23T13:44:25.000Z","updated_at":"2024-07-18T22:56:42.000Z","dependencies_parsed_at":"2022-09-17T19:23:16.963Z","dependency_job_id":null,"html_url":"https://github.com/Sybio/GifFrameExtractor","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sybio%2FGifFrameExtractor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sybio%2FGifFrameExtractor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sybio%2FGifFrameExtractor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Sybio%2FGifFrameExtractor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Sybio","download_url":"https://codeload.github.com/Sybio/GifFrameExtractor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246691579,"owners_count":20818535,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T07:00:49.462Z","updated_at":"2025-04-01T18:31:40.829Z","avatar_url":"https://github.com/Sybio.png","language":"PHP","funding_links":[],"categories":["Libraries","图像","图像 Imagery","目录","Imagery","图像( Imagery )"],"sub_categories":["PHP","图像 Imagery"],"readme":"# ================================\n# GifFrameExtractor\n# ================================\n\nGifFrameExtractor is a PHP class that separates all the frames (and their duration) of an animated GIF\n\n### For what ?\n\nThe class helps you to separate all the frames of an animated GIF, for example to watermark them and then to\ngenerate a new watermarked and animated GIF.\n\n### Usage\n\nGifFrameExtractor is really easy to use:\n\n**1 - Extraction:**\n\n```php\n$gifFilePath = 'path/images/picture.gif';\n\nif (GifFrameExtractor::isAnimatedGif($gifFilePath)) { // check this is an animated GIF\n    \n    $gfe = new GifFrameExtractor();\n    $gfe-\u003eextract($gifFilePath);\n    \n    // Do something with extracted frames ...\n}\n```\n\n**2 - Getting the frames and their duration:**\n\n```php\nforeach ($gfe-\u003egetFrames() as $frame) {\n    \n    // The frame resource image var\n    $img = $frame['image'];\n    \n    // The frame duration\n    $duration = $frame['duration'];\n}\n```\n\nYou can also get separately an array of images and an array of durations:\n\n```php\n$frameImages = $gfe-\u003egetFrameImages();\n$frameDurations = $gfe-\u003egetFrameDurations();\n```\n\nAnd obtain usefull informations:\n\n```php\n$totalDuration = $gfe-\u003egetTotalDuration(); // Total duration of the animated GIF\n$frameNumber = $gfe-\u003egetFrameNumber(); // Number of extracted frames\nvar_dump($gfe-\u003egetFrameDimensions()); // An array containing the dimension of each extracted frame\nvar_dump($gfe-\u003egetFramePositions()); // An array containing the original positions of each extracted frame inside the GIF\n```\n\n**Option:**\n\nYou can choose if you want to get the original frames (with transparency background) or frames pasted on the first one\nwith the second parameter of extract() method:\n\n```php\n$gfe-\u003eextract('path/images/picture.gif', true); // Can get transparency orignal frames\n```\n\nThis option is false by default. \n\n### About\n\nThe class reuses some part of code of \"PHP GIF Animation Resizer\" by Taha PAKSU (thanks to him).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSybio%2FGifFrameExtractor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FSybio%2FGifFrameExtractor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FSybio%2FGifFrameExtractor/lists"}