How to identify GIF image’s no of layers

The MagickWand interface is a new high-level C API interface to ImageMagick core methods. We discourage the use of the core methods and encourage the use of this API instead. Post MagickWand questions, bug reports, and suggestions to this forum.
Post Reply
iashanmugavel
Posts: 1
Joined: 2018-04-04T09:40:41-07:00
Authentication code: 1152

How to identify GIF image’s no of layers

Post by iashanmugavel »

Use case:
In our systsm, user can able to upload all images and it would be converted into different resolutions(thumnail, tiny and medium). We need to validate the images which is having X layers and Y resolutions.

Problem:
While converting GIF images into different resolutions because of high resolutions and more layers our server CPU utilization reaching to 100%.

I dont find any method to validate the number of layers for GIF images.

Identify image.GIF

This is not helping much.

Anyone facing similar issue and found resolutions
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to identify GIF image’s no of layers

Post by fmw42 »

Gif supports frames, not layers. If you mean that then in unix syntax

Code: Select all

identify -format "%n\n" image.gif | head -n 1
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to identify GIF image’s no of layers

Post by snibgo »

iashanmugavel wrote:... our server CPU utilization reaching to 100%.
By default, IM tries to use as much CPU as it can. You cam limit this with settings in policy.xml. See http://www.imagemagick.org/script/security-policy.php
snibgo's IM pages: im.snibgo.com
Post Reply