File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,18 @@ function maxBuffer (screens) {
133133 return total
134134}
135135
136+ function guessFiletype ( filename ) {
137+ switch ( path . extname ( filename ) ) {
138+ case '.jpg' :
139+ case '.jpeg' :
140+ return 'jpeg'
141+ case '.png' :
142+ return 'png'
143+ }
144+
145+ return 'jpeg'
146+ }
147+
136148function linuxSnapshot ( options = { } ) {
137149 return new Promise ( ( resolve , reject ) => {
138150 listDisplays ( ) . then ( ( screens ) => {
@@ -143,8 +155,7 @@ function linuxSnapshot (options = {}) {
143155 encoding : 'buffer' ,
144156 maxBuffer : maxBuffer ( screens )
145157 }
146- const extension = path . extname ( filename ) || '.jpeg'
147- const filetype = extension . substr ( 1 )
158+ const filetype = guessFiletype ( filename )
148159
149160 exec (
150161 `import -silent -window root -crop ${ screen . crop } -screen ${ filetype } :${ filename } ` ,
You can’t perform that action at this time.
0 commit comments