Skip to content

Commit b9fa43e

Browse files
committed
Remove guess image type function, use built-in
1 parent c810183 commit b9fa43e

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

signel.el

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -328,20 +328,6 @@ If TARGET-BUFFER is non-nil, map the request ID to that buffer for error handlin
328328
((file-exists-p path-no-ext) path-no-ext)
329329
(t nil))))))
330330

331-
(defun signel--guess-image-type (file)
332-
"Read the first few bytes of FILE to determine image type (png, webp, gif)."
333-
(with-temp-buffer
334-
(set-buffer-multibyte nil)
335-
(insert-file-contents-literally file nil 0 12)
336-
(goto-char (point-min))
337-
(cond
338-
((looking-at "\x89PNG") 'png)
339-
((looking-at "GIF8") 'gif)
340-
((and (looking-at "RIFF")
341-
(ignore-errors (forward-char 8) (looking-at "WEBP")))
342-
'webp)
343-
(t nil))))
344-
345331
(defun signel--convert-apng-to-gif (file)
346332
"Convert APNG FILE to a temporary GIF using ImageMagick `convert'.
347333
Returns the path to the temporary GIF. Uses `unwind-protect' to ensure cleanup."
@@ -375,7 +361,7 @@ Returns the path to the temporary GIF. Uses `unwind-protect' to ensure cleanup.
375361
(insert "\n")
376362
(cond
377363
((and file (file-exists-p file))
378-
(let* ((type (signel--guess-image-type file))
364+
(let* ((type (image-type-from-file-header file))
379365
(final-file file)
380366
(final-type type)
381367
(converted nil))

0 commit comments

Comments
 (0)