File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,6 +12,12 @@ module.exports = function (gm) {
1212
1313 const IDENTIFYING = 1 ;
1414 const IDENTIFIED = 2 ;
15+
16+ /**
17+ * calculated formats https://imagemagick.org/script/escape.php
18+ * @type {RegExp }
19+ */
20+ const CALCULATED_FORMATS = / % k | % @ | % # /
1521
1622 /**
1723 * Map getter functions to output names.
@@ -268,8 +274,11 @@ module.exports = function (gm) {
268274 function makeArgs ( self , val ) {
269275 var args = [
270276 'identify'
271- , '-ping'
272277 ] ;
278+
279+ if ( ! isFormatCalculated ( val . format ) ) {
280+ args . push ( '-ping' )
281+ }
273282
274283 if ( val . format ) {
275284 args . push ( '-format' , val . format ) ;
@@ -282,6 +291,14 @@ module.exports = function (gm) {
282291 args = args . concat ( self . src ( ) ) ;
283292 return args ;
284293 }
294+
295+ /**
296+ * @param {string|undefined } format
297+ * @returns {boolean }
298+ */
299+ function isFormatCalculated ( format ) {
300+ return ! format || ! ! CALCULATED_FORMATS . test ( format ) ;
301+ }
285302
286303 /**
287304 * Map exif orientation codes to orientation names.
You can’t perform that action at this time.
0 commit comments